123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <view class="list">
- <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
- <view class="address">
- <view class="con">
- <view class="title omit">{{ item.address }} </view>
- <view class="desc">
- <text>{{item.name}}</text>
- <text>{{item.phone}}</text>
- </view>
- </view>
- <view class="icon"></view>
- <view class="clear"></view>
- </view>
- </view>
- <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
- <u-empty v-if="!loadMore && list.length == 0"></u-empty>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- select: false,
- list: [],
- param: { pageNo: 1, pageSize: 10 },
- loadMore: true
- };
- },
- onLoad(e) {
- this.select = e.select || false;
- this.getData();
- uni.$on('address', res => {
- this.refresh();
- });
- },
- methods: {
- getData() {
- this.http.request({
- url: '/transport-server/app/TbFavoriteContacts/getAppList',
- data: this.param,
- loading: 'false',
- success: res => {
- this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
- this.list.push(...res.data.data);
- }
- });
- },
- detail(item) {
- uni.$emit('one-address', item);
- uni.navigateBack();
- },
- //刷新数据
- refresh() {
- this.loadMore = true;
- this.param.pageNo = 1;
- this.list = [];
- this.getData();
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- setTimeout(() => {
- this.refresh();
- uni.stopPullDownRefresh();
- }, 1000);
- },
- //上拉加载
- onReachBottom() {
- if (this.loadMore) {
- this.param.pageNo++;
- this.getData();
- }
- },
- onNavigationBarButtonTap() {
- uni.navigateTo({ url: 'add' });
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: $pg;
- }
- .list {
- padding: 12px;
- .item {
- padding: 5px;
- color: $font-c;
- background-color: white;
- border-radius: 10px;
- margin-bottom: 10px;
- }
- }
- </style>
|