地址列表接口

main
xuechunyuan 2 years ago
parent ceaafe0770
commit fdf05e01f5
  1. 2
      App.vue
  2. 59
      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, url: this.globalData.baseUrl + '/weChatUser/getWeChatUser?openId=' + this.globalData.openId,
method: 'GET', method: 'GET',
success: (res) => { success: (res) => {
console.log(res) // console.log(res)
if (res.data.code == 200) { if (res.data.code == 200) {
uni.setStorageSync('userInfo', JSON.stringify(res.data.data)); uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
uni.setStorageSync('phone', res.data.data.phone); uni.setStorageSync('phone', res.data.data.phone);

@ -18,6 +18,8 @@
</view> </view>
</view> </view>
</view> </view>
<uni-load-more iconType="circle" :status="status" @clickLoadMore="loadMore"
:content-text="contentText"></uni-load-more>
</view> </view>
</template> </template>
@ -25,15 +27,57 @@
export default { export default {
data() { data() {
return { return {
addressData:[ addressData: [],
{name:'张晓明',phone:'132****1021',status:0,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层2097户东户'}, current: 0,
{name:'张三',phone:'131****0021',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层2017户西户'}, size: 10,
{name:'李四',phone:'132****3201',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心'}, hasMore: true,
{name:'王五',phone:'132****0015',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层'}, 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: { 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'
})
}
},
})
}
},
} }
} }
@ -43,6 +87,7 @@
.add_box { .add_box {
width: 100%; width: 100%;
background: #fff; background: #fff;
.address_box { .address_box {
width: 95%; width: 95%;
margin: 0 auto; margin: 0 auto;
@ -55,6 +100,7 @@
.bottom { .bottom {
width: 100%; width: 100%;
.left_bot { .left_bot {
width: 90%; width: 90%;
} }
@ -62,5 +108,4 @@
} }
} }
} }
</style> </style>

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

Loading…
Cancel
Save