|
|
@ -22,8 +22,8 @@ |
|
|
|
</template> |
|
|
|
</van-field> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
<div class="block"> |
|
|
|
<!-- </div> |
|
|
|
<div class="block">--> |
|
|
|
<Picker |
|
|
|
required |
|
|
|
label="所在街道" |
|
|
@ -34,13 +34,13 @@ |
|
|
|
/> |
|
|
|
<Picker |
|
|
|
required |
|
|
|
label="居住社区" |
|
|
|
label="所在社区" |
|
|
|
placeholder="请选择" |
|
|
|
v-model="communityId" |
|
|
|
:items="communityOptions" |
|
|
|
@change="e => setVal('community', e, 'getQuartersForCommunity')" |
|
|
|
/> |
|
|
|
<Picker |
|
|
|
<!-- <Picker |
|
|
|
required |
|
|
|
label="小区" |
|
|
|
placeholder="请选择" |
|
|
@ -71,15 +71,16 @@ |
|
|
|
v-model="houseNumberId" |
|
|
|
:items="houseOptions" |
|
|
|
@change="e => setVal('houseNumber', e)" |
|
|
|
/> |
|
|
|
/>--> |
|
|
|
</div> |
|
|
|
|
|
|
|
<Perfect v-if="type === 'edit'" /> |
|
|
|
<van-button round block @click="submit" color="linear-gradient(to right, #81B5FB, #3E92FF)">提交</van-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import Picker from '@/components/Picker' |
|
|
|
import Perfect from '@/components/Perfect' |
|
|
|
import { |
|
|
|
buildingoption, |
|
|
|
getAllAgencyStreet, |
|
|
@ -94,7 +95,7 @@ import { |
|
|
|
var leftTime |
|
|
|
export default { |
|
|
|
name: 'userInfo', |
|
|
|
components: { Picker }, |
|
|
|
components: { Picker, Perfect }, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
form: {}, |
|
|
@ -123,38 +124,72 @@ export default { |
|
|
|
buildingOptions: [], |
|
|
|
unitOptions: [], |
|
|
|
houseOptions: [], |
|
|
|
type: '' |
|
|
|
type: '', |
|
|
|
city: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
this.type = this.$route.params.type ? this.$route.params.type : '' |
|
|
|
this.userInfo = this.$store.state.app.userInfo |
|
|
|
this.gender = this.$store.state.app.userInfo.gender |
|
|
|
this.getAllAgencyStreet() |
|
|
|
if (this.type === 'edit') { |
|
|
|
this.surName = this.userInfo.realName |
|
|
|
this.gender = this.userInfo.gender |
|
|
|
this.streetId = this.userInfo.streetId |
|
|
|
this.customerId = this.userInfo.customerId |
|
|
|
this.communityId = this.userInfo.communityId |
|
|
|
this.quarterId = this.userInfo.quarterId |
|
|
|
this.buildingId = this.userInfo.buildingId |
|
|
|
this.unitId = this.userInfo.unitId |
|
|
|
this.houseNumberId = this.userInfo.houseNumberId |
|
|
|
this.homeId = this.userInfo.homeId |
|
|
|
this.gridId = this.userInfo.gridId |
|
|
|
this.getChildAgencyByPid() |
|
|
|
this.getQuartersForCommunity() |
|
|
|
this.buildingoption() |
|
|
|
this.unitoption() |
|
|
|
this.houseoption() |
|
|
|
} |
|
|
|
this.init() |
|
|
|
}, |
|
|
|
destroyed() { |
|
|
|
clearInterval(leftTime) |
|
|
|
}, |
|
|
|
watch: {}, |
|
|
|
watch: { |
|
|
|
'$route.params.type'() { |
|
|
|
this.init() |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
init() { |
|
|
|
this.type = this.$route.params.type ? this.$route.params.type : '' |
|
|
|
document.title = this.$route.params.type === 'edit' ? '编辑' : '注册' |
|
|
|
this.userInfo = this.$store.state.app.userInfo |
|
|
|
this.gender = this.$store.state.app.userInfo.gender |
|
|
|
if (this.type === 'edit') { |
|
|
|
this.surName = this.userInfo.realName |
|
|
|
this.gender = this.userInfo.gender |
|
|
|
this.streetId = this.userInfo.streetId |
|
|
|
this.customerId = this.userInfo.customerId |
|
|
|
this.communityId = this.userInfo.communityId |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getAllAgencyStreet() |
|
|
|
this.getChildAgencyByPid() |
|
|
|
console.log(this.streetId, 'this.streetId') |
|
|
|
}) |
|
|
|
|
|
|
|
/* this.quarterId = this.userInfo.quarterId |
|
|
|
this.buildingId = this.userInfo.buildingId |
|
|
|
this.unitId = this.userInfo.unitId |
|
|
|
this.houseNumberId = this.userInfo.houseNumberId |
|
|
|
this.homeId = this.userInfo.homeId |
|
|
|
this.gridId = this.userInfo.gridId |
|
|
|
this.getQuartersForCommunity() |
|
|
|
this.buildingoption() |
|
|
|
this.unitoption() |
|
|
|
this.houseoption()*/ |
|
|
|
} else { |
|
|
|
// 初始化腾讯地图 |
|
|
|
this.geolocation = new qq.maps.Geolocation('LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO', 'myapp') |
|
|
|
// 获取定位 |
|
|
|
this.getMyLocation() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取当前位置 |
|
|
|
getMyLocation() { |
|
|
|
this.geolocation.getLocation(this.showPosition, this.errorPosition) //开启定位 |
|
|
|
}, |
|
|
|
// 定位成功 |
|
|
|
showPosition(position) { |
|
|
|
this.longitude = position.lng |
|
|
|
this.latitude = position.lat |
|
|
|
this.address = position.city + position.addr |
|
|
|
this.city = position.city |
|
|
|
this.getAllAgencyStreet() |
|
|
|
}, |
|
|
|
errorPosition() { |
|
|
|
console.log('定位失败,再次进行定位') |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
let params = { |
|
|
|
gender: this.gender, |
|
|
@ -197,10 +232,10 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
if (!params.communityId) { |
|
|
|
this.$toast.fail('请选择居住社区') |
|
|
|
this.$toast.fail('请选择所在社区') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!params.quarterId) { |
|
|
|
/* if (!params.quarterId) { |
|
|
|
this.$toast.fail('请选择小区') |
|
|
|
return |
|
|
|
} |
|
|
@ -215,7 +250,7 @@ export default { |
|
|
|
if (!params.houseNumberId) { |
|
|
|
this.$toast.fail('请选择门牌号') |
|
|
|
return |
|
|
|
} |
|
|
|
}*/ |
|
|
|
if (this.type !== 'edit') { |
|
|
|
register(params).then(res => { |
|
|
|
localStorage.setItem('token', res.token) |
|
|
@ -300,17 +335,27 @@ export default { |
|
|
|
// 获取街道 |
|
|
|
getAllAgencyStreet() { |
|
|
|
getAllAgencyStreet({}).then(res => { |
|
|
|
console.log(res, 'resresres') |
|
|
|
this.streetOptions = res |
|
|
|
? res.map(item => { |
|
|
|
return { |
|
|
|
label: item.organizationName, |
|
|
|
value: item.id, |
|
|
|
customerId: item.customerId |
|
|
|
} |
|
|
|
}) |
|
|
|
return { |
|
|
|
label: item.organizationName, |
|
|
|
value: item.id, |
|
|
|
customerId: item.customerId |
|
|
|
} |
|
|
|
}) |
|
|
|
: [] |
|
|
|
this.communityOptions = [] |
|
|
|
console.log(this.city) |
|
|
|
if (this.city === '青岛市') { |
|
|
|
this.streetOptions.forEach(item => { |
|
|
|
if (item.label === '海伦路街道') { |
|
|
|
this.streetId = item.value |
|
|
|
this.customerId = item.customerId |
|
|
|
console.log(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.getChildAgencyByPid() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取社区 |
|
|
@ -320,13 +365,13 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
this.communityOptions = res |
|
|
|
? res.map(item => { |
|
|
|
return { |
|
|
|
label: item.organizationName, |
|
|
|
value: item.id |
|
|
|
} |
|
|
|
}) |
|
|
|
return { |
|
|
|
label: item.organizationName, |
|
|
|
value: item.id |
|
|
|
} |
|
|
|
}) |
|
|
|
: [] |
|
|
|
this.gridOptions = [] |
|
|
|
// this.quarterOptions = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取小区 |
|
|
@ -336,14 +381,14 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
this.quarterOptions = res |
|
|
|
? res.map(item => { |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value, |
|
|
|
gridId: item.pid |
|
|
|
} |
|
|
|
}) |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value, |
|
|
|
gridId: item.pid |
|
|
|
} |
|
|
|
}) |
|
|
|
: [] |
|
|
|
this.buildingOptions = [] |
|
|
|
// this.buildingOptions = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取楼栋 |
|
|
@ -353,13 +398,13 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
this.buildingOptions = res |
|
|
|
? res.map(item => { |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
} |
|
|
|
}) |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
} |
|
|
|
}) |
|
|
|
: [] |
|
|
|
this.unitOptions = [] |
|
|
|
// this.unitOptions = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取单元 |
|
|
@ -369,13 +414,13 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
this.unitOptions = res |
|
|
|
? res.map(item => { |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
} |
|
|
|
}) |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
} |
|
|
|
}) |
|
|
|
: [] |
|
|
|
this.houseOptions = [] |
|
|
|
// this.houseOptions = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取房号 |
|
|
@ -385,11 +430,11 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
this.houseOptions = res |
|
|
|
? res.map(item => { |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
} |
|
|
|
}) |
|
|
|
return { |
|
|
|
label: item.label, |
|
|
|
value: item.value |
|
|
|
} |
|
|
|
}) |
|
|
|
: [] |
|
|
|
}) |
|
|
|
} |
|
|
|