|
|
@ -182,19 +182,19 @@ Page({ |
|
|
|
}); |
|
|
|
setTimeout(()=>{ |
|
|
|
this.bindPickerChangeGrid(); |
|
|
|
},500) |
|
|
|
},1000) |
|
|
|
setTimeout(()=>{ |
|
|
|
this.bindPickerChangevillageId(); |
|
|
|
},1000) |
|
|
|
},2000) |
|
|
|
setTimeout(()=>{ |
|
|
|
this.bindPickerChangebuilding() |
|
|
|
},2000) |
|
|
|
},3000) |
|
|
|
setTimeout(()=>{ |
|
|
|
this.bindPickerChangeUnit() |
|
|
|
},3000) |
|
|
|
},4000) |
|
|
|
setTimeout(()=>{ |
|
|
|
this.bindPickerChangeHouse() |
|
|
|
},4000) |
|
|
|
},5000) |
|
|
|
} catch(err) { |
|
|
|
console.log(err); |
|
|
|
} |
|
|
@ -613,23 +613,95 @@ Page({ |
|
|
|
}, |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit(){ |
|
|
|
showToast(title){ |
|
|
|
wx.showToast({ |
|
|
|
title: title, |
|
|
|
duration:2000, |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit: async function() { |
|
|
|
if(!this.data.form.gridId){ |
|
|
|
this.showToast('请选择所在网格') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.villageId){ |
|
|
|
this.showToast('请选择所在小区') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.buildId){ |
|
|
|
this.showToast('请选择所在楼栋') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.unitId){ |
|
|
|
this.showToast('请选择所在单元') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.homeId){ |
|
|
|
this.showToast('请选择所在房屋') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.name){ |
|
|
|
this.showToast('请填写姓名') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.gender){ |
|
|
|
this.showToast('请选择性别') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.birthday){ |
|
|
|
this.showToast('请选择出生日期') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.idNum){ |
|
|
|
this.showToast('请填写证件号') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.form.mobile){ |
|
|
|
this.showToast('请填写联系电话') |
|
|
|
return |
|
|
|
} |
|
|
|
const parm = {...this.data.form} |
|
|
|
console.log(this.data.formType); |
|
|
|
if(this.data.formType == 'edit'){ |
|
|
|
parm.resiId = this.data.resiId |
|
|
|
console.log(parm); |
|
|
|
api.resiEdit(parm).then(res=>{ |
|
|
|
console.log(res); |
|
|
|
}).catch(err=>{ |
|
|
|
try { |
|
|
|
const res = await api.resiEdit(parm) |
|
|
|
console.log(res.code); |
|
|
|
if(res.code === 0){ |
|
|
|
wx.showToast({ |
|
|
|
title: '编辑成功', |
|
|
|
duration:3000, |
|
|
|
success:function(){ |
|
|
|
setTimeout(()=>{ |
|
|
|
wx.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
},3000) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}catch(err) { |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
} |
|
|
|
}else{ |
|
|
|
api.resiAdd(parm).then(res=>{ |
|
|
|
console.log(res); |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
try { |
|
|
|
const res = await api.resiAdd(parm) |
|
|
|
if(res.code === 0){ |
|
|
|
wx.showToast({ |
|
|
|
title: '新增成功', |
|
|
|
duration:3000, |
|
|
|
success:function(){ |
|
|
|
setTimeout(()=>{ |
|
|
|
wx.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
},3000) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}catch(err) { |
|
|
|
console.log(err); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
back() { |
|
|
|