武田小程序
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.
 
 
 

182 lines
3.8 KiB

const app = getApp<IAppOption>();
Page({
data: {
applyDoctorInfo: null,
applyHostipalInfo: null,
invite: false,
DoctorLevel: {},
DoctorTitleType: {},
AuditId: "",
Name: "",
HospitalId: "",
TitleType: "",
OtherTitle: "",
InviteDoctorId: "",
Img: "",
QualificationImg: "",
RegisterImg: "",
PositionImg: "",
},
onLoad(options) {
if (options.hid) {
this.setData({
HospitalId: options.hid,
HospitalName: options.hname,
});
}
app.waitLogin(true).then(() => {
this.getApplyDoctor();
this.getLoastApplyHostipal();
this.getDoctorDict();
});
},
getApplyDoctor() {
app.getApplyDoctor().then((res) => {
if (!Array.isArray(res)) {
this.setData({
applyDoctorInfo: res,
InviteDoctorName: res.InviteDoctorName,
HospitalName: res.HospitalName,
AuditId: res.AuditStatus === 1 ? 0 : res.AuditId,
Name: res.Name,
HospitalId: res.HospitalId,
TitleType: `${res.TitleType}`,
OtherTitle: res.OtherTitle,
InviteDoctorId: res.InviteDoctorId,
Img: res.Img,
QualificationImg: res.QualificationImg,
RegisterImg: res.RegisterImg,
PositionImg: res.PositionImg,
});
}
});
},
getLoastApplyHostipal() {
wx.ajax({
method: "GET",
url: "?r=takeda/reg/last-apply-hospital",
data: {},
}).then((res) => {
this.setData({
applyHostipalInfo: Array.isArray(res) ? null : res,
});
});
},
getDoctorDict() {
wx.ajax({
method: "GET",
url: "?r=takeda/reg/doctor-dict",
data: {},
}).then((res) => {
this.setData({
DoctorLevel: res.DoctorLevel,
DoctorTitleType: res.DoctorTitleType,
});
});
},
handleFile(e) {
const { key } = e.currentTarget.dataset;
this.setData({
[key]: e.detail.imgUrl,
});
},
handleHostipal() {
wx.redirectTo({
url: `/module1/pages/sHostipal/index?prev=${encodeURIComponent("/module1/pages/setInfo/index")}`,
});
},
handleTitleType(e) {
const { value } = e.currentTarget.dataset;
this.setData({
TitleType: value,
});
},
handleSubmit() {
const {
AuditId,
Name,
HospitalId,
TitleType,
OtherTitle,
InviteDoctorId,
Img,
QualificationImg,
RegisterImg,
PositionImg,
} = this.data;
if (!Name) {
wx.showToast({
title: "请输入姓名",
icon: "none",
});
return;
}
if (!HospitalId) {
wx.showToast({
title: "请选择医院",
icon: "none",
});
return;
}
if (!TitleType) {
wx.showToast({
title: "请选择头衔",
icon: "none",
});
return;
}
if (TitleType === "99" && !OtherTitle) {
wx.showToast({
title: "请输入自定义头衔",
icon: "none",
});
return;
}
if (!RegisterImg) {
wx.showToast({
icon: "none",
title: "请上传注册证",
});
return;
}
if (!QualificationImg) {
wx.showToast({
title: "请上传从业资格证",
icon: "none",
});
return;
}
if (!PositionImg) {
wx.showToast({
title: "请上传任职证书",
});
return;
}
wx.ajax({
method: "POST",
url: "?r=takeda/reg/apply-doctor",
data: {
AuditId,
Name,
HospitalId,
TitleType,
OtherTitle,
InviteDoctorId,
Img,
QualificationImg,
RegisterImg,
PositionImg,
},
}).then((res) => {
wx.navigateTo({
url: `/module1/pages/setInfoResult/index?isf=${res.isFollow}&iname=${res.InviteDoctorName}`,
});
});
},
});
export {};