|
@@ -19,8 +19,8 @@
|
|
|
<uni-forms-item label="小区选择">
|
|
|
<uni-data-picker v-model="formData.estateId" :map="pickerMap" :localdata="items" placeholder="请选择地址" popup-title="请选择地址" @change="onchange"></uni-data-picker>
|
|
|
</uni-forms-item>
|
|
|
- <uni-forms-item label="楼栋选择">
|
|
|
- <uni-data-picker v-model="formData.buildingId" :localdata="range" placeholder="请选择小区" popup-title="请选择小区" @change="selectChange"></uni-data-picker>
|
|
|
+ <uni-forms-item label="楼栋选择" v-if="house.range && house.range.length > 0">
|
|
|
+ <uni-data-picker v-model="formData.buildingId" :localdata="house.range" placeholder="请选择小区" popup-title="请选择小区" @change="selectChange"></uni-data-picker>
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item label="单元选择" v-if="house.unit && house.unit.length > 0">
|
|
|
<uni-data-picker v-model="formData.unit" :localdata="house.unit" placeholder="请选择单元" popup-title="请选择单元" @change="unitChange"></uni-data-picker>
|
|
@@ -28,7 +28,7 @@
|
|
|
<uni-forms-item label="楼层选择" v-if="house.floor && house.unit.length > 0">
|
|
|
<uni-data-picker v-model="formData.floor" :localdata="house.floor" placeholder="请选择楼层" popup-title="请选择楼层" @change="floorChange"></uni-data-picker>
|
|
|
</uni-forms-item>
|
|
|
- <uni-forms-item label="门牌选择" v-if="house.number && house.number !== ''">
|
|
|
+ <uni-forms-item label="门牌选择" v-if="house.number && house.number.length > 0">
|
|
|
<uni-data-picker v-model="formData.houseId" :localdata="house.number" placeholder="请选择门牌" popup-title="请选择门牌" @change="houseChange"></uni-data-picker>
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
@@ -46,8 +46,8 @@
|
|
|
return {
|
|
|
formData: {},
|
|
|
sexs: [
|
|
|
- { text: '男', value: 0 },
|
|
|
- { text: '女', value: 1},
|
|
|
+ { text: '男', value: 1 },
|
|
|
+ { text: '女', value: 0 },
|
|
|
],
|
|
|
items: [],
|
|
|
pickerMap: {
|
|
@@ -90,6 +90,10 @@
|
|
|
this.queryInfo();
|
|
|
return;
|
|
|
}
|
|
|
+ if (option.residentReqId) {
|
|
|
+ this.queryReqInfo();
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 设置默认地址信息
|
|
|
const userinfo = uni.getStorageSync('userinfo');
|
|
|
const { estateId, buildingId, unit, floor, houseId } = userinfo;
|
|
@@ -102,6 +106,11 @@
|
|
|
this.items = res.data;
|
|
|
},
|
|
|
methods: {
|
|
|
+ async queryReqInfo() {
|
|
|
+ const userinfo = await requestFamily.getReqInfoDetails({ residentReqId: this.residentReqId });
|
|
|
+ this.formData = userinfo.data;
|
|
|
+ this.setAddr(userinfo.data);
|
|
|
+ },
|
|
|
async queryInfo() {
|
|
|
const userinfo = await requestFamily.getFamilyInfoDetails({ residentId: this.residentId });
|
|
|
this.formData = userinfo.data;
|
|
@@ -111,8 +120,9 @@
|
|
|
async setAddr(data) {
|
|
|
// 小区存在
|
|
|
if (data.estateId && data.estateId !== null) {
|
|
|
- const res = await request.buildingList({ estateId: data.estateId });
|
|
|
- this.range = res.rows.map(e => ({ ...e, text: `${e.number}栋`, value: e.buildingId }));
|
|
|
+ // const res = await request.buildingList({ estateId: data.estateId });
|
|
|
+ // this.range = res.rows.map(e => ({ ...e, text: `${e.number}栋`, value: e.buildingId }));
|
|
|
+ await this.onchange({ detail: { value: [{ value: data.estateId }] } });
|
|
|
}
|
|
|
// 楼栋存在
|
|
|
if(data.buildingId && data.buildingId !== null) {
|
|
@@ -131,14 +141,30 @@
|
|
|
await this.houseChange({ detail: { value: [{ value: data.houseId }] } });
|
|
|
}
|
|
|
},
|
|
|
+ // 初始化选择器
|
|
|
+ initPicker(e) {
|
|
|
+ if (e.includes('range')) this.$set(this.house, 'range', []);
|
|
|
+ if (e.includes('unit')) this.$set(this.house, 'unit', []);
|
|
|
+ if (e.includes('floor')) this.$set(this.house, 'floor', []);
|
|
|
+ if (e.includes('number')) this.$set(this.house, 'number', []);
|
|
|
+ },
|
|
|
+ // 小区选择
|
|
|
async onchange(e) {
|
|
|
+ if (!e || e == '' || e.detail.value.length <= 0) {
|
|
|
+ this.initPicker(['range', 'unit', 'floor', 'number']);
|
|
|
+ return;
|
|
|
+ }
|
|
|
const val = e.detail.value[e.detail.value.length - 1].value;
|
|
|
const res = await request.buildingList({ estateId: val });
|
|
|
- this.range = res.rows.map(e => ({ ...e, text: `${e.number}栋`, value: e.buildingId }));
|
|
|
+ const range = res.rows.map(e => ({ ...e, text: `${e.number}栋`, value: e.buildingId }));
|
|
|
+ this.$set(this.house, 'range', range);
|
|
|
},
|
|
|
// 楼栋选择
|
|
|
async selectChange(e) {
|
|
|
- if (!e || e == '' || e.detail.value.length <= 0) return;
|
|
|
+ if (!e || e == '' || e.detail.value.length <= 0) {
|
|
|
+ this.initPicker(['unit', 'floor', 'number']);
|
|
|
+ return;
|
|
|
+ };
|
|
|
const res = await request.houseList({ buildingId: e.detail.value[0].value });
|
|
|
this.building = res.rows;
|
|
|
const list = [];
|
|
@@ -159,7 +185,10 @@
|
|
|
},
|
|
|
// 单元选择
|
|
|
unitChange(e) {
|
|
|
- if (!e || e == '' || e.detail.value.length <= 0) return;
|
|
|
+ if (!e || e == '' || e.detail.value.length <= 0) {
|
|
|
+ this.initPicker([ 'floor', 'number']);
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.unit = e.detail.value[0].value;
|
|
|
const list = [];
|
|
|
const floor = this.building.filter(j => j.unit == e.detail.value[0].value).map(j => ({ ...j, text: `${j.floor}层`, value: j.floor }));
|
|
@@ -190,15 +219,17 @@
|
|
|
async submit(ref) {
|
|
|
this.$refs[ref].validate(async (err, formdata) => {
|
|
|
if (!err) {
|
|
|
- if (!this.formData.houseId || this.formData.houseId == '') {
|
|
|
+ // 判断勾选后是否添加地址
|
|
|
+ if (!this.formData.estateId || !this.formData.buildingId || !this.formData.houseId == null) {
|
|
|
uni.showToast({
|
|
|
- title: '请选择地址信息',
|
|
|
+ title: '请填写完整地址信息',
|
|
|
+ icon: 'error',
|
|
|
duration: 2000,
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// 居民修改
|
|
|
- this.formData.reqType = this.formData.residentId ? 1 : 0;
|
|
|
+ this.formData.reqType = this.formData.residentId || this.formData.residentReqId ? 1 : 0;
|
|
|
const res = await requestFamily.familyInfo(this.formData);
|
|
|
if (res.code == 200) {
|
|
|
uni.showToast({
|