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

2 months ago
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,
2 months ago
});
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,
2 months ago
});
});
app.zdMpBehavior({ PageName: 'PG_PATIENTINFOENTRY' });
});
3 months ago
},
handleRelationType(e: WechatMiniprogram.CustomEvent) {
2 months ago
const { id } = e.currentTarget.dataset;
3 months ago
this.setData({
relationType: id,
2 months ago
});
3 months ago
},
handleGender(e: WechatMiniprogram.CustomEvent) {
2 months ago
const { id } = e.currentTarget.dataset;
3 months ago
this.setData({
gender: id,
2 months ago
});
3 months ago
},
handleSelectAge(e: WechatMiniprogram.CustomEvent) {
2 months ago
const { id } = e.currentTarget.dataset;
3 months ago
this.setData({
ageRange: id,
2 months ago
});
3 months ago
},
bindChangeDate(e: WechatMiniprogram.CustomEvent) {
2 months ago
const { key } = e.currentTarget.dataset;
3 months ago
this.setData({
[key]: e.detail.value,
2 months ago
});
3 months ago
},
handleDiagnoseTypeSave() {
2 months ago
const rangeIndex = this.data.selectDiagnoseTypeIndex;
const { DiagnoseType } = this.data;
const { id, name } = DiagnoseType[rangeIndex];
3 months ago
this.setData({
diagnoseTypeIndex: rangeIndex,
diagnoseTypeName: name,
diagnoseType: id,
2 months ago
});
this.handleDiagnoseTypeShow();
3 months ago
},
handleDiagnoseTypeShow() {
this.setData({
diagnoseTypeShow: !this.data.diagnoseTypeShow,
2 months ago
});
3 months ago
},
bindChange(e: WechatMiniprogram.CustomEvent) {
2 months ago
const rangeIndex = e.detail.value[0];
3 months ago
this.setData({
selectDiagnoseTypeIndex: rangeIndex,
2 months ago
});
3 months ago
},
handleSubmit() {
2 months ago
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 = "出生日期不能为空";
2 months ago
if (!gender) toast = '请选择性别';
if (!ageRange) toast = '请选择年龄范围';
if (!name) toast = '姓名不能为空';
3 months ago
if (toast) {
2 months ago
wx.showToast({ title: toast, icon: 'none' });
return;
3 months ago
}
2 months ago
const backPage = app.globalData.backPage;
3 months ago
const navUrl =
2 months ago
typeof backPage === 'string' && backPage.includes('liveResult') ? backPage : '/patient/pages/certReslove/index';
3 months ago
this.setData({
submiting: true,
2 months ago
});
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,
2 months ago
});
3 months ago
this.setData({
submiting: false,
2 months ago
});
});
3 months ago
})
.catch(() => {
this.setData({
submiting: false,
2 months ago
});
});
3 months ago
},
handleBack() {
2 months ago
wx.navigateBack();
3 months ago
},
2 months ago
});
3 months ago
2 months ago
export {};