async onSubmit() {
const {
receptionUser,
receptionUserName,
receptionUserTel,
creditCode,
visitUnitName,
supplier,
validStartTime,
validEndTime,
visitType,
} = this.form;
const { user, checkedPeopleList, checkedAreaList } = this;
//数据校验 是否填写
for (const item of this.currentConfig.applyConfig) {
if (!this.form[item.key] && item.key !== 'receptionUser') {
Taro.showToast({ title: `请输入${item.name}`, icon: 'none' });
return;
}
}
if (dayjs(validEndTime).unix() <= dayjs(validStartTime).unix()) {
Taro.showToast({ title: '通行结束小于通行开始时间', icon: 'none' });
return;
}
if (!checkedAreaList.length) {
Taro.showToast({ title: '请选择访问区域', icon: 'none' });
return;
}
if (!checkedPeopleList.length) {
Taro.showToast({ title: '请添加访客信息', icon: 'none' });
return;
}
wx.requestSubscribeMessage({
tmplIds: [
process.env.ORDER_TEMPLATE_ID!,
process.env.ORDER_CAUTION_ID!,
process.env.ORDER_ORDER_ARRIVE_ID!,
],
success: async (resMsg) => {
console.log(resMsg, 'resMsg');
if (
resMsg[process.env.ORDER_TEMPLATE_ID] === 'reject' ||
resMsg[process.env.ORDER_CAUTION_ID] === 'reject' ||
resMsg[process.env.ORDER_ORDER_ARRIVE_ID]
) {
Taro.showToast({ title: '请订阅所有消息', icon: 'none' });
}
// if (
// resMsg[process.env.ORDER_TEMPLATE_ID] === 'accept' &&
// resMsg[process.env.ORDER_CAUTION_ID] === 'accept' &&
// resMsg[process.env.ORDER_ORDER_ARRIVE_ID] === 'accept'
// ) {
console.log('来这儿了');
const { code, msg } = await Services.VisitorApply.CommitApply({
modeStatus: this.currentConfig.fieldId, //动态表单字段
id: this.params.id,
applyUser: user.realName,
applyPhone: user.telephone,
receptionUser: receptionUser,
receptionUserName,
receptionUserTel,
areas: checkedAreaList,
visitorApplyInfos: checkedPeopleList,
creditCode,
visitUnitName,
supplier,
validStartTime: dayjs(validStartTime).format('YYYY-MM-DD HH:mm:ss'),
validEndTime: dayjs(validEndTime).format('YYYY-MM-DD HH:mm:ss'),
visitType,
});
if (code) {
Taro.showToast({ title: msg, icon: 'none' });
} else {
const content = `您好,您填报的航空工业哈飞访客申请信息已成功提交。诚邀您关注航空工业哈飞公众号`;
this.noticeInfo(true, undefined, this.user.realName, content, undefined);
this.updateSelectPeopleList([]);
}
// }
},
fail() {
Taro.showToast({ title: '您已取消订阅', icon: 'none' });
},
});
},
手机回调失败报什么err? 确认手机有订阅消息次数吗?