Browse Source

新增修改后的逻辑修改

jw-featrue-zhanlibiao
mk 2 years ago
parent
commit
b30fa573fd
  1. 2
      pages/work/work.js
  2. 106
      subpages/addResi/pages/addResi/addResi.js
  3. 6
      subpages/addResi/pages/addResi/addResi.wxml

2
pages/work/work.js

@ -8,7 +8,7 @@ Page({
*/
data: {
setlectVal:'resi',
keyWord:''
keyWord:'小程序'
},
/**

106
subpages/addResi/pages/addResi/addResi.js

@ -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() {

6
subpages/addResi/pages/addResi/addResi.wxml

@ -29,7 +29,7 @@
</view>
<view class="form_item">
<view class="label">
<!-- <text class="must">*</text> -->
<text class="must">*</text>
<view class="title">所在小区</view>
</view>
<view class="input">
@ -43,7 +43,7 @@
</view>
<view class="form_item">
<view class="label">
<!-- <text class="must">*</text> -->
<text class="must">*</text>
<view class="title">所在楼栋</view>
</view>
<view class="input">
@ -57,7 +57,7 @@
</view>
<view class="form_item">
<view class="label">
<!-- <text class="must">*</text> -->
<text class="must">*</text>
<view class="title">所在单元</view>
</view>
<view class="input">

Loading…
Cancel
Save