|
@@ -0,0 +1,111 @@
|
|
|
+<script>
|
|
|
+import {getHouseNumberList} from "@/api/digitalDoor";
|
|
|
+
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ show: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ houseNumberDialogShow: {
|
|
|
+ get() {
|
|
|
+ return this.show
|
|
|
+ },
|
|
|
+ set(val) {
|
|
|
+ this.$emit('update:show', val)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ houseNumberAddress: '',
|
|
|
+ },
|
|
|
+ finished: false,
|
|
|
+ loading: false,
|
|
|
+ list: [],
|
|
|
+ queryParams:{
|
|
|
+ current: 1,
|
|
|
+ size: 10
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ try {
|
|
|
+ this.loading = true
|
|
|
+ const res = await getHouseNumberList({
|
|
|
+ ...this.queryParams,
|
|
|
+ houseNumberAddress: this.form.houseNumberAddress
|
|
|
+ })
|
|
|
+ this.list = this.list.concat(res.data)
|
|
|
+ this.finished = res.data.length < 10
|
|
|
+ this.loading = false
|
|
|
+ this.queryParams.current++
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ this.finished = true
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.queryParams.current = 1
|
|
|
+ this.list = []
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ handleAddressClick(item) {
|
|
|
+ this.$emit('click', item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <view>
|
|
|
+ <van-popup v-model="houseNumberDialogShow" position="bottom" :style="{ height: '35%' }">
|
|
|
+ <view class="popup-box">
|
|
|
+ <view class="search-group">
|
|
|
+ <van-field v-model="form.houseNumberAddress" placeholder="请搜索关键词"></van-field>
|
|
|
+ <van-button size="small" color="#198bfe" type="primary" @click="submit">搜索</van-button>
|
|
|
+ </view>
|
|
|
+ <view class="list-content">
|
|
|
+ <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getList">
|
|
|
+ <van-cell v-for="(item,index) in list" :key="index" :title="item.houseNumberAddress" @click="handleAddressClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </van-popup>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.popup-box {
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+.list-content {
|
|
|
+ flex:1;
|
|
|
+ overflow: scroll;
|
|
|
+}
|
|
|
+
|
|
|
+.search-group {
|
|
|
+ padding: 5px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ ::v-deep .van-cell {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .van-button {
|
|
|
+ width: 80px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|