地址列表接口

main
xuechunyuan 2 years ago
parent ceaafe0770
commit fdf05e01f5
  1. 2
      App.vue
  2. 79
      pages/pages_zhentou/myPage/address.vue
  3. 11
      pages/pages_zhentou/myPage/myPage.vue

@ -70,7 +70,7 @@
url: this.globalData.baseUrl + '/weChatUser/getWeChatUser?openId=' + this.globalData.openId,
method: 'GET',
success: (res) => {
console.log(res)
// console.log(res)
if (res.data.code == 200) {
uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
uni.setStorageSync('phone', res.data.data.phone);

@ -13,11 +13,13 @@
{{item.address}}
</view>
<view class="right_bot">
</view>
</view>
</view>
</view>
<uni-load-more iconType="circle" :status="status" @clickLoadMore="loadMore"
:content-text="contentText"></uni-load-more>
</view>
</template>
@ -25,42 +27,85 @@
export default {
data() {
return {
addressData:[
{name:'张晓明',phone:'132****1021',status:0,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层2097户东户'},
{name:'张三',phone:'131****0021',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层2017户西户'},
{name:'李四',phone:'132****3201',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心'},
{name:'王五',phone:'132****0015',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层'},
]
addressData: [],
current: 0,
size: 10,
hasMore: true,
status: '',
contentText: {
contentdown: "点击查看更多",
contentrefresh: "正在加载...",
contentnomore: "没有更多数据了",
}
}
},
onLoad() {
let userInfo = uni.getStorageSync('userInfo');
if (userInfo) {
this.userInfo = JSON.parse(userInfo);
if (this.userInfo.id != undefined) {
this.loadMore();
}
}
},
methods: {
//
loadMore() {
console.log('loadmore')
if (this.hasMore) {
this.current = this.current + 1;
this.staus = 'loading';
uni.request({
url: getApp().globalData.baseUrl + '/address/list?userId=' + this.userInfo.id + '&current=' + this
.current + '&size=' + this.size,
method: 'GET',
success: (res) => {
if (res.data.code == 200) {
this.addressData = this.addressData.concat(res.data.data.records);
if (res.data.data.records.length == 0 || res.data.data.total < this.size) {
this.hasMore = false;
this.status = 'nomore';
} else {
this.status = 'more';
}
} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
},
})
}
},
}
}
</script>
<style lang="scss" scoped>
.add_box{
.add_box {
width: 100%;
background: #fff;
.address_box{
.address_box {
width: 95%;
margin: 0 auto;
margin-top: 40rpx;
.address_item{
.address_item {
width: 100%;
height: 200rpx;
border-bottom: 2rpx solid #ccc;
.bottom{
.bottom {
width: 100%;
.left_bot{
.left_bot {
width: 90%;
}
}
}
}
}
</style>
</style>

@ -27,6 +27,17 @@
</script>
<style lang="scss" scoped>
.person_box{
display: flex;
align-items: center;
margin: 30rpx;
padding: 30rpx;
background-color: #fff;
border-radius: 20rpx;
.avatar{
}
}
.address_box{
width: 95%;
height: 100rpx;

Loading…
Cancel
Save