|
@@ -11,7 +11,13 @@
|
|
</view>
|
|
</view>
|
|
<view class="two">
|
|
<view class="two">
|
|
<view class="two_1" v-if="list&&list.length>0">
|
|
<view class="two_1" v-if="list&&list.length>0">
|
|
- 数据列表
|
|
|
|
|
|
+ scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
|
|
|
|
+ <view class="list-scroll-view">
|
|
|
|
+ <view class="list" v-for="(item, index) in list" :key="index">
|
|
|
|
+
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </scroll-view>
|
|
</view>
|
|
</view>
|
|
<view class="two_2" v-else>
|
|
<view class="two_2" v-else>
|
|
已加载完全部
|
|
已加载完全部
|
|
@@ -26,15 +32,21 @@
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
user: {},
|
|
user: {},
|
|
- list: []
|
|
|
|
|
|
+ list: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ skip: 0,
|
|
|
|
+ limit: 6,
|
|
|
|
+ page: 0,
|
|
|
|
+ // 状态
|
|
|
|
+ statusList: [],
|
|
|
|
+ // 来源
|
|
|
|
+ sourceList: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- onLoad: function(e) {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- onShow: function() {
|
|
|
|
|
|
+ onShow: async function() {
|
|
const that = this;
|
|
const that = this;
|
|
- that.watchLogin()
|
|
|
|
|
|
+ await that.searchOther();
|
|
|
|
+ await that.watchLogin();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
watchLogin() {
|
|
watchLogin() {
|
|
@@ -44,8 +56,75 @@
|
|
success: function(res) {
|
|
success: function(res) {
|
|
let user = that.$jwt(res.data);
|
|
let user = that.$jwt(res.data);
|
|
that.$set(that, `user`, user)
|
|
that.$set(that, `user`, user)
|
|
|
|
+ that.search()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ // 查询列表
|
|
|
|
+ async search() {
|
|
|
|
+ const that = this;
|
|
|
|
+ let user = that.user;
|
|
|
|
+ if (user._id) {
|
|
|
|
+ let info = {
|
|
|
|
+ skip: that.skip,
|
|
|
|
+ limit: that.limit,
|
|
|
|
+ customer: user._id,
|
|
|
|
+ }
|
|
|
|
+ let res = await that.$api(`/point`, 'GET', {
|
|
|
|
+ ...info,
|
|
|
|
+ })
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ let list = [...that.list, ...res.data];
|
|
|
|
+ that.$set(that, `list`, list);
|
|
|
|
+ that.$set(that, `total`, res.total)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ async searchOther() {
|
|
|
|
+ const that = this;
|
|
|
|
+ let res;
|
|
|
|
+ res = await that.$api(`/dictData`, 'GET', {
|
|
|
|
+ code: "point_status"
|
|
|
|
+ });
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ that.$set(that, `statusList`, res.data)
|
|
|
|
+ }
|
|
|
|
+ res = await that.$api(`/dictData`, 'GET', {
|
|
|
|
+ code: "point_source"
|
|
|
|
+ });
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ that.$set(that, `sourceList`, res.data)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 分页
|
|
|
|
+ toPage(e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let list = that.list;
|
|
|
|
+ let limit = that.limit;
|
|
|
|
+ if (that.total > list.length) {
|
|
|
|
+ uni.showLoading({
|
|
|
|
+ title: '加载中',
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+ let page = that.page + 1;
|
|
|
|
+ that.$set(that, `page`, page)
|
|
|
|
+ let skip = page * limit;
|
|
|
|
+ that.$set(that, `skip`, skip)
|
|
|
|
+ that.search();
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ } else uni.showToast({
|
|
|
|
+ title: '没有更多数据了',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 清空列表
|
|
|
|
+ clearPage() {
|
|
|
|
+ const that = this;
|
|
|
|
+ that.$set(that, `list`, [])
|
|
|
|
+ that.$set(that, `skip`, 0)
|
|
|
|
+ that.$set(that, `limit`, 6)
|
|
|
|
+ that.$set(that, `page`, 0)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -96,4 +175,17 @@
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .scroll-view {
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+ right: 0;
|
|
|
|
+ bottom: 0;
|
|
|
|
+
|
|
|
|
+ .list-scroll-view {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|