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

132 lines
3.2 KiB

import dayjs from 'dayjs'
const app = getApp<IAppOption>()
3 months ago
Page({
data: {
relationType: '1',
name: '',
gender: '',
birth: '',
ageRange: '',
diagnosisTime: '',
diagnoseType: '',
diagnoseTypeShow: false,
DiagnoseType: app.globalData.DiagnoseType,
diagnoseTypeIndex: '',
diagnoseTypeName: '',
selectDiagnoseTypeIndex: '0',
currentDate: dayjs().format('YYYY-MM'),
submiting: false,
proces: '0',
},
onLoad(options) {
this.setData({
pagePath: options.page,
proces: options.proces,
})
3 months ago
app.zdWaitLogin({ isReg: false, loginPage: true }).then(() => {
app.getZdUserInfo(this, true, (zdUserInfo) => {
3 months ago
this.setData({
3 months ago
relationType: zdUserInfo.RelationType || '1',
name: zdUserInfo.PatientName,
gender: zdUserInfo.Gender,
ageRange: zdUserInfo.AgeRange,
})
})
app.zdMpBehavior({ PageName: 'PG_PATIENTINFOENTRY' })
})
3 months ago
},
handleRelationType(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
3 months ago
this.setData({
relationType: id,
})
3 months ago
},
handleGender(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
3 months ago
this.setData({
gender: id,
})
3 months ago
},
handleSelectAge(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset
3 months ago
this.setData({
ageRange: id,
})
3 months ago
},
handleSubmit() {
if (this.data.submiting) return
app.zdMpBehavior({ PageName: 'BTN_PATIENTINFONEXT' })
const { name, gender, ageRange, relationType } = this.data
const { registrationSource, registChannel, regBusinessId, WorkerId, IsAliQiWei } = app.globalData
const { doctorId, inviteChan } = app.globalData.scene
let toast = ''
3 months ago
// if (!diagnosisTime) toast = "确诊时间不能为空";
// if (!birth) toast = "出生日期不能为空";
if (!gender) toast = '请选择性别'
if (!ageRange) toast = '请选择年龄范围'
if (!name) toast = '姓名不能为空'
3 months ago
if (toast) {
wx.showToast({ title: toast, icon: 'none' })
return
3 months ago
}
const backPage = app.globalData.backPage
3 months ago
const navUrl =
typeof backPage === 'string' && backPage.includes('liveResult') ? backPage : '/patient/pages/certReslove/index'
3 months ago
this.setData({
submiting: true,
})
3 months ago
wx.ajax({
method: 'POST',
3 months ago
url: '?r=zd/account/reg',
3 months ago
data: {
name,
gender,
ageRange,
// birth,
// diagnoseType,
// diagnosisTime,
relationType,
registrationSource,
registChannel,
regBusinessId,
WorkerId,
inviteDoctorId: doctorId,
inviteChannel: inviteChan,
IsAliQiWei,
},
})
.then((_res) => {
2 months ago
app.updateLoginInfo(() => {
3 months ago
wx.reLaunch({
url: navUrl,
})
3 months ago
this.setData({
submiting: false,
})
})
3 months ago
})
.catch(() => {
this.setData({
submiting: false,
})
})
3 months ago
},
handleBack() {
wx.navigateBack({
fail() {
wx.reLaunch({
url: '/patient/pages/login/index',
})
},
})
3 months ago
},
})
3 months ago
export {}