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

268 lines
5.9 KiB

import dayjs from 'dayjs'
2 months ago
const app = getApp<IAppOption>()
6 months ago
Page({
data: {
relationType: '1',
name: '',
gender: '',
birth: '',
ageRange: '',
diagnosisTime: '',
diagnoseType: '',
IsGraves: '',
HasTedSurgery: '',
isKnowTituyo: '',
isUseTituyo: '',
prescriptionImg: '',
6 months ago
diagnoseTypeShow: false,
DiagnoseType: app.globalData.DiagnoseType,
diagnoseTypeIndex: '',
diagnoseTypeName: '',
selectDiagnoseTypeIndex: '0',
currentDate: dayjs().format('YYYY-MM'),
submiting: false,
proces: '0',
dict: {},
bolList: {
1: '是',
2: '否',
},
popupShow: false,
popupType: 'popup7',
popupParams: {} as any,
6 months ago
},
onLoad(options) {
this.setData({
pagePath: options.page,
proces: options.proces,
})
app.waitLogin().then(() => {
6 months ago
app.mpBehavior({ PageName: 'PG_PatientInfo' })
this.getDict()
6 months ago
app.getZdUserInfo(this, true, (zdUserInfo) => {
6 months ago
this.setData({
6 months ago
relationType: zdUserInfo.RelationType || '1',
name: zdUserInfo.PatientName,
gender: zdUserInfo.Gender,
ageRange: zdUserInfo.AgeRange,
})
})
})
6 months ago
},
getDict() {
wx.ajax({
method: 'GET',
url: '?r=xd/user/get-dict',
data: {},
}).then((res) => {
this.setData({
dict: res,
})
})
},
6 months ago
handleRelationType(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
6 months ago
this.setData({
relationType: id,
})
6 months ago
},
handleGender(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
6 months ago
this.setData({
gender: id,
})
6 months ago
},
handleSelectAge(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
6 months ago
this.setData({
ageRange: id,
})
6 months ago
},
handleSelectIsGraves(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
IsGraves: id,
})
},
handleSelectHasTedSurgery(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
this.setData({
HasTedSurgery: id,
})
},
handleSelectKnowTituyo(e) {
const { id } = e.currentTarget.dataset
this.setData({
isKnowTituyo: id,
})
},
handleSelectUseTituyo(e) {
const { id } = e.currentTarget.dataset
this.setData({
isUseTituyo: id,
})
wx.pageScrollTo({
scrollTop: 10000,
})
},
6 months ago
handleSubmit() {
6 months ago
app.mpBehavior({ PageName: 'BTN_PatientInfoComfirm' })
2 months ago
if (this.data.submiting)
return
const {
name,
gender,
ageRange,
relationType,
IsGraves,
HasTedSurgery,
isKnowTituyo,
isUseTituyo,
prescriptionImg,
} = this.data
const { registrationSource, registChannel, regBusinessId, WorkerId, IsAliQiWei } = app.globalData
const { doctorId, inviteChan, proMethodId } = app.globalData.scene
let toast = ''
6 months ago
// if (!diagnosisTime) toast = "确诊时间不能为空";
// if (!birth) toast = "出生日期不能为空";
2 months ago
if (!gender)
toast = '请选择性别'
if (!ageRange)
toast = '请选择年龄范围'
if (!name)
toast = '姓名不能为空'
6 months ago
if (toast) {
wx.showToast({ title: toast, icon: 'none' })
return
6 months ago
}
const backPage = app.globalData.backPage
2 months ago
const navUrl
= typeof backPage === 'string' && backPage.includes('liveResult') ? backPage : '/patient/pages/certReslove/index'
6 months ago
this.setData({
submiting: true,
})
6 months ago
wx.ajax({
method: 'POST',
6 months ago
url: '?r=zd/account/reg',
6 months ago
data: {
name,
gender,
ageRange,
// birth,
// diagnoseType,
// diagnosisTime,
relationType,
registrationSource,
registChannel,
regBusinessId,
IsGraves,
HasTedSurgery,
isKnowTituyo,
isUseTituyo,
prescriptionImg,
6 months ago
WorkerId,
inviteDoctorId: doctorId,
inviteChannel: inviteChan,
IsAliQiWei,
promotionMethodId: proMethodId,
6 months ago
},
})
.then((_res) => {
6 months ago
app.updateLoginInfo(() => {
6 months ago
wx.reLaunch({
url: navUrl,
})
6 months ago
this.setData({
submiting: false,
})
})
6 months ago
})
.catch(() => {
this.setData({
submiting: false,
})
})
6 months ago
},
handleVisitors() {
6 months ago
app.mpBehavior({ PageName: 'BTN_PatientInfoSkip' })
2 months ago
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({
2 months ago
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: '',
})
},
handlePreview() {
wx.previewImage({
urls: [this.data.prescriptionImg],
})
},
6 months ago
handleBack() {
wx.navigateBack({
fail() {
wx.reLaunch({
url: '/patient/pages/login/index',
})
},
})
6 months ago
},
})
6 months ago
export {}