Browse Source

新增修改后的逻辑修改

jw-featrue-zhanlibiao
mk 2 years ago
parent
commit
b30fa573fd
  1. 2
      pages/work/work.js
  2. 104
      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: { data: {
setlectVal:'resi', setlectVal:'resi',
keyWord:'' keyWord:'小程序'
}, },
/** /**

104
subpages/addResi/pages/addResi/addResi.js

@ -182,19 +182,19 @@ Page({
}); });
setTimeout(()=>{ setTimeout(()=>{
this.bindPickerChangeGrid(); this.bindPickerChangeGrid();
},500) },1000)
setTimeout(()=>{ setTimeout(()=>{
this.bindPickerChangevillageId(); this.bindPickerChangevillageId();
},1000) },2000)
setTimeout(()=>{ setTimeout(()=>{
this.bindPickerChangebuilding() this.bindPickerChangebuilding()
},2000) },3000)
setTimeout(()=>{ setTimeout(()=>{
this.bindPickerChangeUnit() this.bindPickerChangeUnit()
},3000) },4000)
setTimeout(()=>{ setTimeout(()=>{
this.bindPickerChangeHouse() this.bindPickerChangeHouse()
},4000) },5000)
} catch(err) { } catch(err) {
console.log(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} const parm = {...this.data.form}
console.log(this.data.formType);
if(this.data.formType == 'edit'){ if(this.data.formType == 'edit'){
parm.resiId = this.data.resiId parm.resiId = this.data.resiId
console.log(parm); try {
api.resiEdit(parm).then(res=>{ const res = await api.resiEdit(parm)
console.log(res); console.log(res.code);
}).catch(err=>{ if(res.code === 0){
console.log(err); wx.showToast({
title: '编辑成功',
duration:3000,
success:function(){
setTimeout(()=>{
wx.navigateBack({
delta: 1
}) })
}else{ },3000)
api.resiAdd(parm).then(res=>{ }
console.log(res); })
}).catch(err=>{ }
}catch(err) {
console.log(err); console.log(err);
}
}else{
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() { back() {

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

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

Loading…
Cancel
Save