Browse Source

房屋类型回显

release
ZhaoTongYao 3 years ago
parent
commit
86c2b95be3
  1. 68
      subpages/family/pages/editHouseInfo/editHouseInfo.js
  2. 12
      subpages/family/pages/editHouseInfo/editHouseInfo.wxml

68
subpages/family/pages/editHouseInfo/editHouseInfo.js

@ -17,6 +17,7 @@ Page({
mobile:'', // 房主电话
},
buildingunitlist: [], // 单元
houseTypeIndex: 0,
houseType: [ // 房屋类型
{
value: "1",
@ -31,6 +32,7 @@ Page({
label: "别墅",
}
],
purposeIndex: 0,
purposeArr: [ // 房屋用途
{ value: '1', label: '住宅' },
{ value: '2', label: '商业' },
@ -40,6 +42,7 @@ Page({
{ value: '6', label: '商住混用' },
{ value: '7', label: '其他' }
],
rentFlagArrIndex: 0,
rentFlagArr: [ // 居住情况
{ value: '1', label: '出租' },
{ value: '2', label: '闲置' },
@ -71,6 +74,27 @@ Page({
this.setData({
fmData: res.data
})
this.data.houseType.forEach((item, index) => {
if (item.value == res.data.roomType) {
this.setData({
houseTypeIndex: index
})
}
})
this.data.purposeArr.forEach((item, index) => {
if (item.value == res.data.roomUse) {
this.setData({
purposeArrIndex: index
})
}
})
this.data.rentFlagArr.forEach((item, index) => {
if (item.value == res.data.livingStatus) {
this.setData({
rentFlagArrIndex: index
})
}
})
console.log(this.data.fmData);
}
},
@ -96,20 +120,24 @@ Page({
},
// 房屋类型
houseTypePicker(e){
console.log('111111111', e)
this.setData({
'fmData.roomType' : this.data.houseType[e.detail.value].label
houseTypeIndex: e.detail.value,
'fmData.roomType' : this.data.houseType[e.detail.value].value
})
},
// 房屋途径
housePurposePicker(e){
this.setData({
'fmData.roomUse' : this.data.purposeArr[e.detail.value].label
purposeArrIndex: e.detail.value,
'fmData.roomUse' : this.data.purposeArr[e.detail.value].value
})
},
// 房屋状态
houseStatePicker(e){
this.setData({
'fmData.livingStatus' : this.data.rentFlagArr[e.detail.value].label
rentFlagArrIndex: e.detail.value,
'fmData.livingStatus' : this.data.rentFlagArr[e.detail.value].value
})
},
@ -176,16 +204,6 @@ Page({
return !!(last === lastNo && format)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
async onShow() {
},
// 修改提交
async editSubmit () {
if (!this.computeSubmitBtnIsAllowed(false)) return;
@ -272,28 +290,4 @@ Page({
return true;
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

12
subpages/family/pages/editHouseInfo/editHouseInfo.wxml

@ -124,8 +124,8 @@
<picker class="picker"
range="{{houseType}}"
range-key="label"
bindchange="houseTypePicker">
<view class="picker-text" wx:if="{{fmData.roomType}}">{{fmData.roomType}}</view>
bindchange="houseTypePicker" value="{{houseTypeIndex}}">
<view class="picker-text" wx:if="{{fmData.roomType}}">{{houseType[houseTypeIndex].label}}</view>
<view class="picker-text z-weak" wx:else>请选择</view>
<image class="menu-arrow" src="/subpages/family/images/arrow.png" mode="aspectFit" />
</picker>
@ -141,8 +141,8 @@
<picker class="picker"
range="{{purposeArr}}"
range-key="label"
bindchange="housePurposePicker">
<view class="picker-text" wx:if="{{fmData.roomUse}}">{{fmData.roomUse}}</view>
bindchange="housePurposePicker" value="{{purposeArrIndex}}">
<view class="picker-text" wx:if="{{fmData.roomUse}}">{{purposeArr[purposeArrIndex].label}}</view>
<view class="picker-text z-weak" wx:else>请选择</view>
<image class="menu-arrow" src="/subpages/family/images/arrow.png" mode="aspectFit" />
</picker>
@ -158,8 +158,8 @@
<picker class="picker"
range="{{rentFlagArr}}"
range-key="label"
bindchange="houseStatePicker">
<view class="picker-text" wx:if="{{fmData.livingStatus}}">{{fmData.livingStatus}}</view>
bindchange="houseStatePicker" value="{{rentFlagArrIndex}}">
<view class="picker-text" wx:if="{{fmData.livingStatus}}">{{rentFlagArr[rentFlagArrIndex].label}}</view>
<view class="picker-text z-weak" wx:else>请选择</view>
<image class="menu-arrow" src="/subpages/family/images/arrow.png" mode="aspectFit" />
</picker>

Loading…
Cancel
Save