const _my = require("../../__antmove/api/index.js")(my); const wx = _my; // pages/regular_visit_records/regular_visit_records.js const { visitoryVisitList } = require("../../utils/api/api"); const app = getApp(); import international from "../../international/appointment_scence/index"; Page({ /** * 页面的初始数据 */ data: { international: international, language: app.data.language, list_apply: [], //tab的current currentPage: 0, searchData_apply: { data: { visitingType: null, userWhiteCheckVOList: [{}] }, pageNum: 1, pageSize: 6, pages: 1 }, total: null }, //详情 goDteail(e) { let item = e.target.dataset.item; wx.navigateTo({ url: "/pages/regular_visit_details/regular_visit_details?list=" + JSON.stringify(item) }); }, // scrollView触底事件 reachBottom(e) { this.getList(e.currentTarget.dataset.type); }, // 获取列表 type-> 1:初始化 2:下拉加载 getList(type) { let { searchData_apply, list_apply } = this.data; if (type === 2 && searchData_apply.pageNum + 1 > searchData_apply.pages) return; searchData_apply.data.userId = app.data.userInfo.userId; searchData_apply.pageNum = type === 1 ? 1 : searchData_apply.pageNum + 1; visitoryVisitList(searchData_apply).then(res => { list_apply = type === 1 ? res.data.list : list_apply.concat(res.data.list); searchData_apply.pages = res.data.pages; this.setData({ list_apply: list_apply, total: res.data.total }); }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) {}, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() {}, /** * 生命周期函数--监听页面显示 */ onShow: function() { this.setData({ language: app.data.language }); this.getList(1); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { this.getList(this.data.pageNum); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { this.getList(2); }, /** * 用户点击右上角分享 */ onShareAppMessage: function() {} });