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

154 lines
3.8 KiB

3 months ago
import dayjs from 'dayjs'
const app = getApp<IAppOption>()
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,
3 months ago
})
})
app.zdMpBehavior({ PageName: 'PG_PATIENTINFOENTRY' })
})
},
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,
})
},
bindChangeDate(e: WechatMiniprogram.CustomEvent) {
const { key } = e.currentTarget.dataset
this.setData({
[key]: e.detail.value,
})
},
handleDiagnoseTypeSave() {
const rangeIndex = this.data.selectDiagnoseTypeIndex
const { DiagnoseType } = this.data
const { id, name } = DiagnoseType[rangeIndex]
this.setData({
diagnoseTypeIndex: rangeIndex,
diagnoseTypeName: name,
diagnoseType: id,
})
this.handleDiagnoseTypeShow()
},
handleDiagnoseTypeShow() {
this.setData({
diagnoseTypeShow: !this.data.diagnoseTypeShow,
})
},
bindChange(e: WechatMiniprogram.CustomEvent) {
const rangeIndex = e.detail.value[0]
this.setData({
selectDiagnoseTypeIndex: rangeIndex,
})
},
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 = ''
// if (!diagnosisTime) toast = "确诊时间不能为空";
// if (!birth) toast = "出生日期不能为空";
if (!gender) toast = '请选择性别'
if (!ageRange) toast = '请选择年龄范围'
if (!name) toast = '姓名不能为空'
if (toast) {
wx.showToast({ title: toast, icon: 'none' })
return
}
const backPage = app.globalData.backPage
const navUrl =
3 months ago
typeof backPage === 'string' && backPage.includes('liveResult') ? backPage : '/patient/pages/certReslove/index'
3 months ago
this.setData({
submiting: true,
})
wx.ajax({
method: 'POST',
url: '?r=xd/account/reg',
data: {
name,
gender,
ageRange,
// birth,
// diagnoseType,
// diagnosisTime,
relationType,
registrationSource,
registChannel,
regBusinessId,
WorkerId,
inviteDoctorId: doctorId,
inviteChannel: inviteChan,
IsAliQiWei,
},
})
.then((_res) => {
3 months ago
app.getZdUserInfo(this, true, () => {
3 months ago
wx.reLaunch({
url: navUrl,
})
this.setData({
submiting: false,
})
})
})
.catch(() => {
this.setData({
submiting: false,
})
})
},
handleBack() {
wx.navigateBack()
},
})
export {}