diff --git a/api/message.js b/api/message.js
index 653520d..9671b10 100644
--- a/api/message.js
+++ b/api/message.js
@@ -9,9 +9,9 @@
const GET_MESSAGE_INFO = BASE_URL + '/visitor/getMessageInfo';
//消息列表
-export function getMessageList(phone) {
+export function getMessageList(param) {
useNetWork();
- return fetch.post(GET_MESSAGE_LIST).then(res => res);
+ return fetch.post(GET_MESSAGE_LIST, param).then(res => res);
}
//消息详情
diff --git a/api/message.js b/api/message.js
index 653520d..9671b10 100644
--- a/api/message.js
+++ b/api/message.js
@@ -9,9 +9,9 @@
const GET_MESSAGE_INFO = BASE_URL + '/visitor/getMessageInfo';
//消息列表
-export function getMessageList(phone) {
+export function getMessageList(param) {
useNetWork();
- return fetch.post(GET_MESSAGE_LIST).then(res => res);
+ return fetch.post(GET_MESSAGE_LIST, param).then(res => res);
}
//消息详情
diff --git a/components/base/LoadingList.vue b/components/base/LoadingList.vue
new file mode 100644
index 0000000..e423d68
--- /dev/null
+++ b/components/base/LoadingList.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ 加载中...
+
+
+ 没有更多了
+
+
+
+
+
+
diff --git a/api/message.js b/api/message.js
index 653520d..9671b10 100644
--- a/api/message.js
+++ b/api/message.js
@@ -9,9 +9,9 @@
const GET_MESSAGE_INFO = BASE_URL + '/visitor/getMessageInfo';
//消息列表
-export function getMessageList(phone) {
+export function getMessageList(param) {
useNetWork();
- return fetch.post(GET_MESSAGE_LIST).then(res => res);
+ return fetch.post(GET_MESSAGE_LIST, param).then(res => res);
}
//消息详情
diff --git a/components/base/LoadingList.vue b/components/base/LoadingList.vue
new file mode 100644
index 0000000..e423d68
--- /dev/null
+++ b/components/base/LoadingList.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ 加载中...
+
+
+ 没有更多了
+
+
+
+
+
+
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/api/message.js b/api/message.js
index 653520d..9671b10 100644
--- a/api/message.js
+++ b/api/message.js
@@ -9,9 +9,9 @@
const GET_MESSAGE_INFO = BASE_URL + '/visitor/getMessageInfo';
//消息列表
-export function getMessageList(phone) {
+export function getMessageList(param) {
useNetWork();
- return fetch.post(GET_MESSAGE_LIST).then(res => res);
+ return fetch.post(GET_MESSAGE_LIST, param).then(res => res);
}
//消息详情
diff --git a/components/base/LoadingList.vue b/components/base/LoadingList.vue
new file mode 100644
index 0000000..e423d68
--- /dev/null
+++ b/components/base/LoadingList.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ 加载中...
+
+
+ 没有更多了
+
+
+
+
+
+
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/pages.json b/pages.json
index 7fe2933..f2a5ec6 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,8 @@
"style" :
{
"navigationBarTitleText": "消息",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 10
}
},
{
diff --git a/api/message.js b/api/message.js
index 653520d..9671b10 100644
--- a/api/message.js
+++ b/api/message.js
@@ -9,9 +9,9 @@
const GET_MESSAGE_INFO = BASE_URL + '/visitor/getMessageInfo';
//消息列表
-export function getMessageList(phone) {
+export function getMessageList(param) {
useNetWork();
- return fetch.post(GET_MESSAGE_LIST).then(res => res);
+ return fetch.post(GET_MESSAGE_LIST, param).then(res => res);
}
//消息详情
diff --git a/components/base/LoadingList.vue b/components/base/LoadingList.vue
new file mode 100644
index 0000000..e423d68
--- /dev/null
+++ b/components/base/LoadingList.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ 加载中...
+
+
+ 没有更多了
+
+
+
+
+
+
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/pages.json b/pages.json
index 7fe2933..f2a5ec6 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,8 @@
"style" :
{
"navigationBarTitleText": "消息",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 10
}
},
{
diff --git a/pages/list/list.vue b/pages/list/list.vue
index 29a9adb..686c775 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -118,6 +118,7 @@
+
@@ -131,9 +132,10 @@
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
import BASE_URL from "@/api/base.js";
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
@@ -142,6 +144,8 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
},
list: [],
isExportShow: false,
@@ -165,9 +169,14 @@
isTimeZ: "",
statusInfo: "筛选状态",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
async onShow() {
+ this.offset = 1;
let pages = getCurrentPages();
const curPage = pages[pages.length - 1];
this.currentPagePath = curPage.route;
@@ -175,7 +184,6 @@
//验证手机号
this.phone = uni.getStorageSync("registerPhone");
- console.log("----------", typeof this.phone);
this.checkphone();
this.queryList = {
@@ -183,9 +191,15 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
- const res = await getList({});
- this.list = res.map((item) => {
+ const param = {
+ offset: 1,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -201,11 +215,14 @@
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
this.queryList = {
keywords: "",
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
this.statusInfo = "筛选状态";
this.time = "筛选时间";
@@ -215,6 +232,10 @@
this.checkboxList = [];
this.checkExport = "所有";
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
methods: {
//选中的数据
checkboxChange(item) {
@@ -227,9 +248,14 @@
},
//搜索框发生改变
async change(e) {
+ this.offset = 1;
if (e.trim() === "") {
- const res = await getList({});
- return (this.list = res.map((item) => {
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ return (this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -279,27 +305,34 @@
},
//根据条件搜索
async searchList() {
+ if(!this.loading) {
+ this.list = [];
+ }
+ this.queryList.offset = this.offset;
const res = await getList(this.queryList);
- if (res.length == 0) {
- this.list = [];
- } else {
- this.list = res.map((item) => {
- if (item.visitorApplyStatus == "1") {
- item.status = "申请已提交";
- item.color = "blue";
- } else if (item.visitorApplyStatus == "2") {
- item.status = "申请已通过";
- item.color = "green";
- } else {
- item.status = "申请未通过";
- item.color = "red";
- }
- return item;
- });
- }
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const resData = res.records.map((item) => {
+ if (item.visitorApplyStatus == "1") {
+ item.status = "申请已提交";
+ item.color = "blue";
+ } else if (item.visitorApplyStatus == "2") {
+ item.status = "申请已通过";
+ item.color = "green";
+ } else {
+ item.status = "申请未通过";
+ item.color = "red";
+ }
+ return item;
+ });
+ this.list = this.list.concat(resData);
+ } else {
+ this.nothingMore = true;
+ }
},
//选中状态
statusSelect(e) {
+ this.offset = 1;
this.statusInfo = e.name;
this.queryList.status = e.id;
this.searchList();
@@ -331,6 +364,7 @@
},
//取消选择时间
closeTime() {
+ this.offset = 1;
this.startTimeShow = false;
this.time = "筛选时间";
this.queryList = {
@@ -338,10 +372,13 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
},
//确定选择结束时间
async confirmEndTime(e) {
+ this.offset = 1;
this.queryList.endTime = await this.shijianc(e.value);
this.isTimeZ = await this.yueFen(e.value);
this.time = `${this.isTimeQ}${this.isTimeZ}`;
@@ -350,6 +387,7 @@
},
//确定选择开始时间
async confirmTime(e) {
+ this.offset = 1;
this.queryList.startTime = await this.shijianc(e.value);
this.isTimeQ = await this.yueFen(e.value);
this.startTimeShow = false;
@@ -416,7 +454,14 @@
},
closePop() {
this.popShow = false;
-
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.searchList();
+ this.loading = false;
}
},
};
diff --git a/api/message.js b/api/message.js
index 653520d..9671b10 100644
--- a/api/message.js
+++ b/api/message.js
@@ -9,9 +9,9 @@
const GET_MESSAGE_INFO = BASE_URL + '/visitor/getMessageInfo';
//消息列表
-export function getMessageList(phone) {
+export function getMessageList(param) {
useNetWork();
- return fetch.post(GET_MESSAGE_LIST).then(res => res);
+ return fetch.post(GET_MESSAGE_LIST, param).then(res => res);
}
//消息详情
diff --git a/components/base/LoadingList.vue b/components/base/LoadingList.vue
new file mode 100644
index 0000000..e423d68
--- /dev/null
+++ b/components/base/LoadingList.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ 加载中...
+
+
+ 没有更多了
+
+
+
+
+
+
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/pages.json b/pages.json
index 7fe2933..f2a5ec6 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,8 @@
"style" :
{
"navigationBarTitleText": "消息",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 10
}
},
{
diff --git a/pages/list/list.vue b/pages/list/list.vue
index 29a9adb..686c775 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -118,6 +118,7 @@
+
@@ -131,9 +132,10 @@
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
import BASE_URL from "@/api/base.js";
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
@@ -142,6 +144,8 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
},
list: [],
isExportShow: false,
@@ -165,9 +169,14 @@
isTimeZ: "",
statusInfo: "筛选状态",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
async onShow() {
+ this.offset = 1;
let pages = getCurrentPages();
const curPage = pages[pages.length - 1];
this.currentPagePath = curPage.route;
@@ -175,7 +184,6 @@
//验证手机号
this.phone = uni.getStorageSync("registerPhone");
- console.log("----------", typeof this.phone);
this.checkphone();
this.queryList = {
@@ -183,9 +191,15 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
- const res = await getList({});
- this.list = res.map((item) => {
+ const param = {
+ offset: 1,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -201,11 +215,14 @@
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
this.queryList = {
keywords: "",
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
this.statusInfo = "筛选状态";
this.time = "筛选时间";
@@ -215,6 +232,10 @@
this.checkboxList = [];
this.checkExport = "所有";
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
methods: {
//选中的数据
checkboxChange(item) {
@@ -227,9 +248,14 @@
},
//搜索框发生改变
async change(e) {
+ this.offset = 1;
if (e.trim() === "") {
- const res = await getList({});
- return (this.list = res.map((item) => {
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ return (this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -279,27 +305,34 @@
},
//根据条件搜索
async searchList() {
+ if(!this.loading) {
+ this.list = [];
+ }
+ this.queryList.offset = this.offset;
const res = await getList(this.queryList);
- if (res.length == 0) {
- this.list = [];
- } else {
- this.list = res.map((item) => {
- if (item.visitorApplyStatus == "1") {
- item.status = "申请已提交";
- item.color = "blue";
- } else if (item.visitorApplyStatus == "2") {
- item.status = "申请已通过";
- item.color = "green";
- } else {
- item.status = "申请未通过";
- item.color = "red";
- }
- return item;
- });
- }
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const resData = res.records.map((item) => {
+ if (item.visitorApplyStatus == "1") {
+ item.status = "申请已提交";
+ item.color = "blue";
+ } else if (item.visitorApplyStatus == "2") {
+ item.status = "申请已通过";
+ item.color = "green";
+ } else {
+ item.status = "申请未通过";
+ item.color = "red";
+ }
+ return item;
+ });
+ this.list = this.list.concat(resData);
+ } else {
+ this.nothingMore = true;
+ }
},
//选中状态
statusSelect(e) {
+ this.offset = 1;
this.statusInfo = e.name;
this.queryList.status = e.id;
this.searchList();
@@ -331,6 +364,7 @@
},
//取消选择时间
closeTime() {
+ this.offset = 1;
this.startTimeShow = false;
this.time = "筛选时间";
this.queryList = {
@@ -338,10 +372,13 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
},
//确定选择结束时间
async confirmEndTime(e) {
+ this.offset = 1;
this.queryList.endTime = await this.shijianc(e.value);
this.isTimeZ = await this.yueFen(e.value);
this.time = `${this.isTimeQ}${this.isTimeZ}`;
@@ -350,6 +387,7 @@
},
//确定选择开始时间
async confirmTime(e) {
+ this.offset = 1;
this.queryList.startTime = await this.shijianc(e.value);
this.isTimeQ = await this.yueFen(e.value);
this.startTimeShow = false;
@@ -416,7 +454,14 @@
},
closePop() {
this.popShow = false;
-
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.searchList();
+ this.loading = false;
}
},
};
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 1122e40..2f62298 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -52,6 +52,7 @@
+
@@ -63,16 +64,21 @@
import { verifyPhone } from "@/api/index.js";
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
- isManager: false,
- list: [],
+ isManager: false, //是否是物业管理员
+ list: [],
phone: "",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
onShow() {
@@ -85,13 +91,20 @@
console.log("----------", typeof this.phone);
this.checkphone();
this.fetchMessageList();
+ this.offset = 1;
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
+ this.list = [];
this.fetchMessageList().then(() => {
uni.stopPullDownRefresh(); //停止下拉刷新
});
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
mounted() {
if (uni.getStorageSync("userInfo")) {
const userInfo = JSON.parse(uni.getStorageSync("userInfo"));
@@ -103,6 +116,7 @@
}
},
methods: {
+ //跳转消息详情页
clickDetail(id) {
wx.navigateTo({
url: `/pages/checkMessageDetail/checkMessageDetail?id=${id}`,
@@ -110,30 +124,43 @@
},
//获取消息列表
async fetchMessageList() {
- const res = await getMessageList();
- this.list = res.map((item) => {
- return {
- id: item.message_id,
- name: item.visitor_name,
- number: item.staff_code,
- timeData: item.apply_time,
- startTime: dateToString(
- new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
- "yyyy-MM-dd"
- ),
- endTime: dateToString(
- new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
- "yyyy-MM-dd"
- ),
- status:
- item.visitor_apply_status === "1"
- ? "已提交"
- : item.visitor_apply_status === "2"
- ? "已通过"
- : "未通过",
- messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
- };
- });
+ if(!this.loading) {
+ this.list = [];
+ }
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getMessageList(param);
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const responseData = res.records.map((item) => {
+ return {
+ id: item.message_id,
+ name: item.visitor_name,
+ number: item.staff_code,
+ timeData: item.apply_time,
+ startTime: dateToString(
+ new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
+ "yyyy-MM-dd"
+ ),
+ endTime: dateToString(
+ new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
+ "yyyy-MM-dd"
+ ),
+ status:
+ item.visitor_apply_status === "1"
+ ? "已提交"
+ : item.visitor_apply_status === "2"
+ ? "已通过"
+ : "未通过",
+ messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
+ };
+ });
+ this.list = this.list.concat(responseData);
+ } else {
+ this.nothingMore = true;
+ }
},
async checkphone() {
//有电话就去验证
@@ -155,6 +182,14 @@
},
closePop() {
this.popShow = false;
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.fetchMessageList();
+ this.loading = false;
}
},
};
@@ -162,6 +197,7 @@
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/pages.json b/pages.json
index 7fe2933..f2a5ec6 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,8 @@
"style" :
{
"navigationBarTitleText": "消息",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 10
}
},
{
diff --git a/pages/list/list.vue b/pages/list/list.vue
index 29a9adb..686c775 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -118,6 +118,7 @@
+
@@ -131,9 +132,10 @@
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
import BASE_URL from "@/api/base.js";
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
@@ -142,6 +144,8 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
},
list: [],
isExportShow: false,
@@ -165,9 +169,14 @@
isTimeZ: "",
statusInfo: "筛选状态",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
async onShow() {
+ this.offset = 1;
let pages = getCurrentPages();
const curPage = pages[pages.length - 1];
this.currentPagePath = curPage.route;
@@ -175,7 +184,6 @@
//验证手机号
this.phone = uni.getStorageSync("registerPhone");
- console.log("----------", typeof this.phone);
this.checkphone();
this.queryList = {
@@ -183,9 +191,15 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
- const res = await getList({});
- this.list = res.map((item) => {
+ const param = {
+ offset: 1,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -201,11 +215,14 @@
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
this.queryList = {
keywords: "",
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
this.statusInfo = "筛选状态";
this.time = "筛选时间";
@@ -215,6 +232,10 @@
this.checkboxList = [];
this.checkExport = "所有";
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
methods: {
//选中的数据
checkboxChange(item) {
@@ -227,9 +248,14 @@
},
//搜索框发生改变
async change(e) {
+ this.offset = 1;
if (e.trim() === "") {
- const res = await getList({});
- return (this.list = res.map((item) => {
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ return (this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -279,27 +305,34 @@
},
//根据条件搜索
async searchList() {
+ if(!this.loading) {
+ this.list = [];
+ }
+ this.queryList.offset = this.offset;
const res = await getList(this.queryList);
- if (res.length == 0) {
- this.list = [];
- } else {
- this.list = res.map((item) => {
- if (item.visitorApplyStatus == "1") {
- item.status = "申请已提交";
- item.color = "blue";
- } else if (item.visitorApplyStatus == "2") {
- item.status = "申请已通过";
- item.color = "green";
- } else {
- item.status = "申请未通过";
- item.color = "red";
- }
- return item;
- });
- }
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const resData = res.records.map((item) => {
+ if (item.visitorApplyStatus == "1") {
+ item.status = "申请已提交";
+ item.color = "blue";
+ } else if (item.visitorApplyStatus == "2") {
+ item.status = "申请已通过";
+ item.color = "green";
+ } else {
+ item.status = "申请未通过";
+ item.color = "red";
+ }
+ return item;
+ });
+ this.list = this.list.concat(resData);
+ } else {
+ this.nothingMore = true;
+ }
},
//选中状态
statusSelect(e) {
+ this.offset = 1;
this.statusInfo = e.name;
this.queryList.status = e.id;
this.searchList();
@@ -331,6 +364,7 @@
},
//取消选择时间
closeTime() {
+ this.offset = 1;
this.startTimeShow = false;
this.time = "筛选时间";
this.queryList = {
@@ -338,10 +372,13 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
},
//确定选择结束时间
async confirmEndTime(e) {
+ this.offset = 1;
this.queryList.endTime = await this.shijianc(e.value);
this.isTimeZ = await this.yueFen(e.value);
this.time = `${this.isTimeQ}${this.isTimeZ}`;
@@ -350,6 +387,7 @@
},
//确定选择开始时间
async confirmTime(e) {
+ this.offset = 1;
this.queryList.startTime = await this.shijianc(e.value);
this.isTimeQ = await this.yueFen(e.value);
this.startTimeShow = false;
@@ -416,7 +454,14 @@
},
closePop() {
this.popShow = false;
-
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.searchList();
+ this.loading = false;
}
},
};
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 1122e40..2f62298 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -52,6 +52,7 @@
+
@@ -63,16 +64,21 @@
import { verifyPhone } from "@/api/index.js";
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
- isManager: false,
- list: [],
+ isManager: false, //是否是物业管理员
+ list: [],
phone: "",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
onShow() {
@@ -85,13 +91,20 @@
console.log("----------", typeof this.phone);
this.checkphone();
this.fetchMessageList();
+ this.offset = 1;
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
+ this.list = [];
this.fetchMessageList().then(() => {
uni.stopPullDownRefresh(); //停止下拉刷新
});
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
mounted() {
if (uni.getStorageSync("userInfo")) {
const userInfo = JSON.parse(uni.getStorageSync("userInfo"));
@@ -103,6 +116,7 @@
}
},
methods: {
+ //跳转消息详情页
clickDetail(id) {
wx.navigateTo({
url: `/pages/checkMessageDetail/checkMessageDetail?id=${id}`,
@@ -110,30 +124,43 @@
},
//获取消息列表
async fetchMessageList() {
- const res = await getMessageList();
- this.list = res.map((item) => {
- return {
- id: item.message_id,
- name: item.visitor_name,
- number: item.staff_code,
- timeData: item.apply_time,
- startTime: dateToString(
- new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
- "yyyy-MM-dd"
- ),
- endTime: dateToString(
- new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
- "yyyy-MM-dd"
- ),
- status:
- item.visitor_apply_status === "1"
- ? "已提交"
- : item.visitor_apply_status === "2"
- ? "已通过"
- : "未通过",
- messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
- };
- });
+ if(!this.loading) {
+ this.list = [];
+ }
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getMessageList(param);
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const responseData = res.records.map((item) => {
+ return {
+ id: item.message_id,
+ name: item.visitor_name,
+ number: item.staff_code,
+ timeData: item.apply_time,
+ startTime: dateToString(
+ new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
+ "yyyy-MM-dd"
+ ),
+ endTime: dateToString(
+ new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
+ "yyyy-MM-dd"
+ ),
+ status:
+ item.visitor_apply_status === "1"
+ ? "已提交"
+ : item.visitor_apply_status === "2"
+ ? "已通过"
+ : "未通过",
+ messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
+ };
+ });
+ this.list = this.list.concat(responseData);
+ } else {
+ this.nothingMore = true;
+ }
},
async checkphone() {
//有电话就去验证
@@ -155,6 +182,14 @@
},
closePop() {
this.popShow = false;
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.fetchMessageList();
+ this.loading = false;
}
},
};
@@ -162,6 +197,7 @@
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/pages.json b/pages.json
index 7fe2933..f2a5ec6 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,8 @@
"style" :
{
"navigationBarTitleText": "消息",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 10
}
},
{
diff --git a/pages/list/list.vue b/pages/list/list.vue
index 29a9adb..686c775 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -118,6 +118,7 @@
+
@@ -131,9 +132,10 @@
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
import BASE_URL from "@/api/base.js";
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
@@ -142,6 +144,8 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
},
list: [],
isExportShow: false,
@@ -165,9 +169,14 @@
isTimeZ: "",
statusInfo: "筛选状态",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
async onShow() {
+ this.offset = 1;
let pages = getCurrentPages();
const curPage = pages[pages.length - 1];
this.currentPagePath = curPage.route;
@@ -175,7 +184,6 @@
//验证手机号
this.phone = uni.getStorageSync("registerPhone");
- console.log("----------", typeof this.phone);
this.checkphone();
this.queryList = {
@@ -183,9 +191,15 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
- const res = await getList({});
- this.list = res.map((item) => {
+ const param = {
+ offset: 1,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -201,11 +215,14 @@
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
this.queryList = {
keywords: "",
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
this.statusInfo = "筛选状态";
this.time = "筛选时间";
@@ -215,6 +232,10 @@
this.checkboxList = [];
this.checkExport = "所有";
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
methods: {
//选中的数据
checkboxChange(item) {
@@ -227,9 +248,14 @@
},
//搜索框发生改变
async change(e) {
+ this.offset = 1;
if (e.trim() === "") {
- const res = await getList({});
- return (this.list = res.map((item) => {
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ return (this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -279,27 +305,34 @@
},
//根据条件搜索
async searchList() {
+ if(!this.loading) {
+ this.list = [];
+ }
+ this.queryList.offset = this.offset;
const res = await getList(this.queryList);
- if (res.length == 0) {
- this.list = [];
- } else {
- this.list = res.map((item) => {
- if (item.visitorApplyStatus == "1") {
- item.status = "申请已提交";
- item.color = "blue";
- } else if (item.visitorApplyStatus == "2") {
- item.status = "申请已通过";
- item.color = "green";
- } else {
- item.status = "申请未通过";
- item.color = "red";
- }
- return item;
- });
- }
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const resData = res.records.map((item) => {
+ if (item.visitorApplyStatus == "1") {
+ item.status = "申请已提交";
+ item.color = "blue";
+ } else if (item.visitorApplyStatus == "2") {
+ item.status = "申请已通过";
+ item.color = "green";
+ } else {
+ item.status = "申请未通过";
+ item.color = "red";
+ }
+ return item;
+ });
+ this.list = this.list.concat(resData);
+ } else {
+ this.nothingMore = true;
+ }
},
//选中状态
statusSelect(e) {
+ this.offset = 1;
this.statusInfo = e.name;
this.queryList.status = e.id;
this.searchList();
@@ -331,6 +364,7 @@
},
//取消选择时间
closeTime() {
+ this.offset = 1;
this.startTimeShow = false;
this.time = "筛选时间";
this.queryList = {
@@ -338,10 +372,13 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
},
//确定选择结束时间
async confirmEndTime(e) {
+ this.offset = 1;
this.queryList.endTime = await this.shijianc(e.value);
this.isTimeZ = await this.yueFen(e.value);
this.time = `${this.isTimeQ}${this.isTimeZ}`;
@@ -350,6 +387,7 @@
},
//确定选择开始时间
async confirmTime(e) {
+ this.offset = 1;
this.queryList.startTime = await this.shijianc(e.value);
this.isTimeQ = await this.yueFen(e.value);
this.startTimeShow = false;
@@ -416,7 +454,14 @@
},
closePop() {
this.popShow = false;
-
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.searchList();
+ this.loading = false;
}
},
};
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 1122e40..2f62298 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -52,6 +52,7 @@
+
@@ -63,16 +64,21 @@
import { verifyPhone } from "@/api/index.js";
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
- isManager: false,
- list: [],
+ isManager: false, //是否是物业管理员
+ list: [],
phone: "",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
onShow() {
@@ -85,13 +91,20 @@
console.log("----------", typeof this.phone);
this.checkphone();
this.fetchMessageList();
+ this.offset = 1;
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
+ this.list = [];
this.fetchMessageList().then(() => {
uni.stopPullDownRefresh(); //停止下拉刷新
});
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
mounted() {
if (uni.getStorageSync("userInfo")) {
const userInfo = JSON.parse(uni.getStorageSync("userInfo"));
@@ -103,6 +116,7 @@
}
},
methods: {
+ //跳转消息详情页
clickDetail(id) {
wx.navigateTo({
url: `/pages/checkMessageDetail/checkMessageDetail?id=${id}`,
@@ -110,30 +124,43 @@
},
//获取消息列表
async fetchMessageList() {
- const res = await getMessageList();
- this.list = res.map((item) => {
- return {
- id: item.message_id,
- name: item.visitor_name,
- number: item.staff_code,
- timeData: item.apply_time,
- startTime: dateToString(
- new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
- "yyyy-MM-dd"
- ),
- endTime: dateToString(
- new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
- "yyyy-MM-dd"
- ),
- status:
- item.visitor_apply_status === "1"
- ? "已提交"
- : item.visitor_apply_status === "2"
- ? "已通过"
- : "未通过",
- messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
- };
- });
+ if(!this.loading) {
+ this.list = [];
+ }
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getMessageList(param);
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const responseData = res.records.map((item) => {
+ return {
+ id: item.message_id,
+ name: item.visitor_name,
+ number: item.staff_code,
+ timeData: item.apply_time,
+ startTime: dateToString(
+ new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
+ "yyyy-MM-dd"
+ ),
+ endTime: dateToString(
+ new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
+ "yyyy-MM-dd"
+ ),
+ status:
+ item.visitor_apply_status === "1"
+ ? "已提交"
+ : item.visitor_apply_status === "2"
+ ? "已通过"
+ : "未通过",
+ messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
+ };
+ });
+ this.list = this.list.concat(responseData);
+ } else {
+ this.nothingMore = true;
+ }
},
async checkphone() {
//有电话就去验证
@@ -155,6 +182,14 @@
},
closePop() {
this.popShow = false;
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.fetchMessageList();
+ this.loading = false;
}
},
};
@@ -162,6 +197,7 @@
diff --git a/components/base/getphonePopup.vue b/components/base/getphonePopup.vue
index 4d2ecb0..fdc5996 100644
--- a/components/base/getphonePopup.vue
+++ b/components/base/getphonePopup.vue
@@ -52,7 +52,7 @@
url: "/pages/register/register",
});
} else {
- getUserProfile();
+ await getUserProfile();
}
}
else if(e.detail.errMsg === 'getPhoneNumber:fail user deny'){ //取消
diff --git a/pages.json b/pages.json
index 7fe2933..f2a5ec6 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,8 @@
"style" :
{
"navigationBarTitleText": "消息",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 10
}
},
{
diff --git a/pages/list/list.vue b/pages/list/list.vue
index 29a9adb..686c775 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -118,6 +118,7 @@
+
@@ -131,9 +132,10 @@
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
import BASE_URL from "@/api/base.js";
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
@@ -142,6 +144,8 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
},
list: [],
isExportShow: false,
@@ -165,9 +169,14 @@
isTimeZ: "",
statusInfo: "筛选状态",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
async onShow() {
+ this.offset = 1;
let pages = getCurrentPages();
const curPage = pages[pages.length - 1];
this.currentPagePath = curPage.route;
@@ -175,7 +184,6 @@
//验证手机号
this.phone = uni.getStorageSync("registerPhone");
- console.log("----------", typeof this.phone);
this.checkphone();
this.queryList = {
@@ -183,9 +191,15 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
- const res = await getList({});
- this.list = res.map((item) => {
+ const param = {
+ offset: 1,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -201,11 +215,14 @@
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
this.queryList = {
keywords: "",
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
this.statusInfo = "筛选状态";
this.time = "筛选时间";
@@ -215,6 +232,10 @@
this.checkboxList = [];
this.checkExport = "所有";
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
methods: {
//选中的数据
checkboxChange(item) {
@@ -227,9 +248,14 @@
},
//搜索框发生改变
async change(e) {
+ this.offset = 1;
if (e.trim() === "") {
- const res = await getList({});
- return (this.list = res.map((item) => {
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getList(param);
+ return (this.list = res.records.map((item) => {
if (item.visitorApplyStatus == "1") {
item.status = "申请已提交";
item.color = "blue";
@@ -279,27 +305,34 @@
},
//根据条件搜索
async searchList() {
+ if(!this.loading) {
+ this.list = [];
+ }
+ this.queryList.offset = this.offset;
const res = await getList(this.queryList);
- if (res.length == 0) {
- this.list = [];
- } else {
- this.list = res.map((item) => {
- if (item.visitorApplyStatus == "1") {
- item.status = "申请已提交";
- item.color = "blue";
- } else if (item.visitorApplyStatus == "2") {
- item.status = "申请已通过";
- item.color = "green";
- } else {
- item.status = "申请未通过";
- item.color = "red";
- }
- return item;
- });
- }
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const resData = res.records.map((item) => {
+ if (item.visitorApplyStatus == "1") {
+ item.status = "申请已提交";
+ item.color = "blue";
+ } else if (item.visitorApplyStatus == "2") {
+ item.status = "申请已通过";
+ item.color = "green";
+ } else {
+ item.status = "申请未通过";
+ item.color = "red";
+ }
+ return item;
+ });
+ this.list = this.list.concat(resData);
+ } else {
+ this.nothingMore = true;
+ }
},
//选中状态
statusSelect(e) {
+ this.offset = 1;
this.statusInfo = e.name;
this.queryList.status = e.id;
this.searchList();
@@ -331,6 +364,7 @@
},
//取消选择时间
closeTime() {
+ this.offset = 1;
this.startTimeShow = false;
this.time = "筛选时间";
this.queryList = {
@@ -338,10 +372,13 @@
startTime: "",
endTime: "",
status: "",
+ offset: this.offset,
+ limit: this.limit
};
},
//确定选择结束时间
async confirmEndTime(e) {
+ this.offset = 1;
this.queryList.endTime = await this.shijianc(e.value);
this.isTimeZ = await this.yueFen(e.value);
this.time = `${this.isTimeQ}${this.isTimeZ}`;
@@ -350,6 +387,7 @@
},
//确定选择开始时间
async confirmTime(e) {
+ this.offset = 1;
this.queryList.startTime = await this.shijianc(e.value);
this.isTimeQ = await this.yueFen(e.value);
this.startTimeShow = false;
@@ -416,7 +454,14 @@
},
closePop() {
this.popShow = false;
-
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.searchList();
+ this.loading = false;
}
},
};
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 1122e40..2f62298 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -52,6 +52,7 @@
+
@@ -63,16 +64,21 @@
import { verifyPhone } from "@/api/index.js";
import { getLogin, getUserProfile } from "@/utils/auth.js";
import GetPhonePopup from "@/components/base/getphonePopup.vue"
+import LoadingList from '@/components/base/LoadingList.vue';
export default {
components: {
- TabBar, GetPhonePopup
+ TabBar, GetPhonePopup, LoadingList
},
data() {
return {
- isManager: false,
- list: [],
+ isManager: false, //是否是物业管理员
+ list: [],
phone: "",
popShow: false, //控制授权手机号弹出框
+ offset: 1, //页数
+ limit: 10, //一页几条数据
+ nothingMore: false, //上拉加载-没有数据了
+ loading: false, //是否显示上拉加载-加载中
};
},
onShow() {
@@ -85,13 +91,20 @@
console.log("----------", typeof this.phone);
this.checkphone();
this.fetchMessageList();
+ this.offset = 1;
},
//下拉刷新
onPullDownRefresh() {
+ this.offset = 1;
+ this.list = [];
this.fetchMessageList().then(() => {
uni.stopPullDownRefresh(); //停止下拉刷新
});
},
+ //上滑加载
+ onReachBottom() {
+ this.getLoadingList();
+ },
mounted() {
if (uni.getStorageSync("userInfo")) {
const userInfo = JSON.parse(uni.getStorageSync("userInfo"));
@@ -103,6 +116,7 @@
}
},
methods: {
+ //跳转消息详情页
clickDetail(id) {
wx.navigateTo({
url: `/pages/checkMessageDetail/checkMessageDetail?id=${id}`,
@@ -110,30 +124,43 @@
},
//获取消息列表
async fetchMessageList() {
- const res = await getMessageList();
- this.list = res.map((item) => {
- return {
- id: item.message_id,
- name: item.visitor_name,
- number: item.staff_code,
- timeData: item.apply_time,
- startTime: dateToString(
- new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
- "yyyy-MM-dd"
- ),
- endTime: dateToString(
- new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
- "yyyy-MM-dd"
- ),
- status:
- item.visitor_apply_status === "1"
- ? "已提交"
- : item.visitor_apply_status === "2"
- ? "已通过"
- : "未通过",
- messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
- };
- });
+ if(!this.loading) {
+ this.list = [];
+ }
+ const param = {
+ offset: this.offset,
+ limit: this.limit
+ }
+ const res = await getMessageList(param);
+ if(res.records && res.records.length) {
+ this.nothingMore = false;
+ const responseData = res.records.map((item) => {
+ return {
+ id: item.message_id,
+ name: item.visitor_name,
+ number: item.staff_code,
+ timeData: item.apply_time,
+ startTime: dateToString(
+ new Date(item.apply_time.slice(0, item.apply_time.indexOf("-"))),
+ "yyyy-MM-dd"
+ ),
+ endTime: dateToString(
+ new Date(item.apply_time.slice(item.apply_time.indexOf("-") + 1)),
+ "yyyy-MM-dd"
+ ),
+ status:
+ item.visitor_apply_status === "1"
+ ? "已提交"
+ : item.visitor_apply_status === "2"
+ ? "已通过"
+ : "未通过",
+ messageTime: getDateTime(new Date(Number(item.send_time)).getTime()),
+ };
+ });
+ this.list = this.list.concat(responseData);
+ } else {
+ this.nothingMore = true;
+ }
},
async checkphone() {
//有电话就去验证
@@ -155,6 +182,14 @@
},
closePop() {
this.popShow = false;
+ },
+ //上拉加载
+ async getLoadingList() {
+ if (this.nothingMore) return;
+ this.offset = this.offset + 1;
+ this.loading = true;
+ await this.fetchMessageList();
+ this.loading = false;
}
},
};
@@ -162,6 +197,7 @@