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

341 lines
7.6 KiB

import dayjs from 'dayjs'
const app = getApp<IAppOption>()
Page({
data: {
step: 0,
relationType: '1',
name: '',
gender: '',
birth: '',
ageRange: '',
diagnosisTime: '',
diagnoseType: '',
IsGraves: '',
HasTedSurgery: '',
isKnowTituyo: '',
isUseTituyo: '',
prescriptionImg: '',
diseaseStage: '',
diseasePeriod: '',
tituyo: {},
diagnoseTypeShow: false,
DiagnoseType: app.globalData.DiagnoseType,
diagnoseTypeIndex: '',
diagnoseTypeName: '',
selectDiagnoseTypeIndex: '0',
currentDate: dayjs().format('YYYY-MM'),
submiting: false,
proces: '0',
dict: {},
bolList: {
1: '是',
2: '否',
},
show: false,
popupShow: false,
// popupType: 'popup7',
popupType: 'popup15',
popupParams: {} as any,
jump: 0,
},
onLoad(options) {
this.setData({
pagePath: options.page,
proces: options.proces,
})
app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_PatientInfo' })
this.getDict()
app.getZdUserInfo(this, true, (zdUserInfo) => {
this.setData({
relationType: zdUserInfo.RelationType || '1',
name: zdUserInfo.PatientName,
gender: zdUserInfo.Gender,
ageRange: zdUserInfo.AgeRange,
IsGraves: zdUserInfo.IsGraves,
isKnowTituyo: zdUserInfo.IsKnowTituyo,
diseaseStage: zdUserInfo.DiseaseStage,
diseasePeriod: zdUserInfo.DiseaseStage,
HasTedSurgery: zdUserInfo.HasTedSurgery,
})
})
})
},
getDict() {
wx.ajax({
method: 'GET',
url: '?r=xd/user/get-dict',
data: {},
}).then((res) => {
this.setData({
dict: res,
})
})
},
handleRelationType(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
relationType: id,
})
},
handleGender(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
gender: id,
})
},
handleSelectAge(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
ageRange: id,
})
},
handleSelectIsGraves(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
IsGraves: id,
})
},
handleSelectDiseaseStage(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
diseaseStage: id,
})
},
handleSelectDiseasePeriod(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
diseasePeriod: id,
})
},
handleSelectHasTedSurgery(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
HasTedSurgery: id,
})
},
handleSelectIsKnowTituyo(e) {
const { id } = e.currentTarget.dataset
this.setData({
isKnowTituyo: id,
})
},
handleSelectKnowTituyo(e) {
const { id } = e.currentTarget.dataset
const { tituyo } = this.data
let show = false
tituyo[id] = !tituyo[id]
if (id == 4 && tituyo[id]) {
show = true
}
this.setData({
tituyo,
show,
})
},
handleSelectUseTituyo(e) {
const { id } = e.currentTarget.dataset
this.setData({
isUseTituyo: id,
})
wx.pageScrollTo({
scrollTop: 10000,
})
},
handleNext() {
const { name, gender, ageRange, relationType, diseaseStage } = this.data
if (!name || !gender || !ageRange || !relationType || !diseaseStage) {
wx.showToast({ title: '完善个人信息,可获得【医生】更多关注', icon: 'none' })
return
}
this.setData({
step: 1,
})
},
handlePopupSubmit() {
const { prescriptionImg } = this.data
if (!prescriptionImg) {
wx.showToast({
icon: 'none',
title: '请上传您的处方证明',
})
return
}
this.setData({
show: false,
})
this.handleSubmit()
},
handlePopupJump() {
this.setData({
show: false,
jump: 1,
})
this.handleSubmit()
},
handleSubmit() {
app.mpBehavior({ PageName: 'BTN_PatientInfoComfirm' })
if (this.data.submiting)
return
const {
name,
gender,
ageRange,
relationType,
diseaseStage,
diseasePeriod,
IsGraves,
HasTedSurgery,
isKnowTituyo,
tituyo,
prescriptionImg,
jump,
} = this.data
const { registrationSource, registChannel, regBusinessId, WorkerId, IsAliQiWei } = app.globalData
const { doctorId, inviteChan, proMethodId } = app.globalData.scene
if (!name || !gender || !ageRange || !relationType || !diseaseStage || !diseasePeriod) {
wx.showToast({ title: '完善个人信息,可获得【医生】更多关注', icon: 'none' })
return
}
const backPage = app.globalData.backPage
const navUrl
= typeof backPage === 'string' && backPage.includes('liveResult') ? backPage : '/patient/pages/certReslove/index'
this.setData({
submiting: true,
})
wx.ajax({
method: 'POST',
url: '?r=zd/account/reg',
data: {
name,
gender,
ageRange,
// birth,
// diagnoseType,
// diagnosisTime,
relationType,
registrationSource,
registChannel,
regBusinessId,
IsGraves,
HasTedSurgery,
diseaseStage,
diseasePeriod,
prescriptionImg,
isKnowTituyo,
tituyo: Object.keys(tituyo),
WorkerId,
inviteDoctorId: doctorId,
inviteChannel: inviteChan,
IsAliQiWei,
promotionMethodId: proMethodId,
},
})
.then((_res) => {
app.updateLoginInfo(() => {
wx.reLaunch({
url: navUrl.includes('?') ? `${navUrl}&jump=${jump}` : `${navUrl}?jump=${jump}`,
})
this.setData({
submiting: false,
})
})
})
.catch(() => {
this.setData({
submiting: false,
})
})
},
handleVisitors() {
app.mpBehavior({ PageName: 'BTN_PatientInfoSkip' })
const backPage = app.globalData.backPage
const navUrl
= typeof backPage === 'string' && backPage.includes('liveResult')
? backPage.replace('liveResult', 'liveDetail')
: '/patient/pages/index/index?visitors=1'
wx.ajax({
method: 'POST',
url: '?r=zd/login/reg-logout',
data: {},
showMsg: false,
}).then(() => {
app.startLogin(() => {
wx.reLaunch({
url: navUrl,
success() {
app.globalData.backPath = ''
if (navUrl.includes('liveDetail')) {
setTimeout(() => {
wx.showToast({
title: '注册后可享平台完整服务',
icon: 'none',
})
}, 1000)
}
},
})
})
})
},
handleSetData(e) {
this.setData({
prescriptionImg: e.detail.imgUrl,
})
},
handleDelData() {
this.setData({
popupShow: true,
popupType: 'popup7',
})
},
handlePopupOk() {
this.setData({
popupShow: false,
popupType: '',
prescriptionImg: '',
})
},
handlePopupCancel() {
this.setData({
popupShow: false,
popupType: '',
})
},
handlePopupClose() {
this.setData({
show: false,
})
},
handlePreview() {
wx.previewImage({
urls: [this.data.prescriptionImg],
})
},
handleBack() {
wx.navigateBack({
fail() {
wx.reLaunch({
url: '/patient/pages/login/index',
})
},
})
},
})
export {}