visit_records.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. const _my = require("../../__antmove/api/index.js")(my);
  2. const wx = _my;
  3. // pages/regular_visit_records/regular_visit_records.js
  4. const { visitoryVisitList } = require("../../utils/api/api");
  5. const app = getApp();
  6. import international from "../../international/appointment_scence/index";
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. international: international,
  13. language: app.data.language,
  14. list_apply: [],
  15. //tab的current
  16. currentPage: 0,
  17. searchData_apply: {
  18. data: {
  19. visitingType: null,
  20. userWhiteCheckVOList: [{}]
  21. },
  22. pageNum: 1,
  23. pageSize: 6,
  24. pages: 1
  25. },
  26. total: null
  27. },
  28. //详情
  29. goDteail(e) {
  30. let item = e.target.dataset.item;
  31. wx.navigateTo({
  32. url:
  33. "/pages/regular_visit_details/regular_visit_details?list=" +
  34. JSON.stringify(item)
  35. });
  36. },
  37. // scrollView触底事件
  38. reachBottom(e) {
  39. this.getList(e.currentTarget.dataset.type);
  40. },
  41. // 获取列表 type-> 1:初始化 2:下拉加载
  42. getList(type) {
  43. let { searchData_apply, list_apply } = this.data;
  44. if (type === 2 && searchData_apply.pageNum + 1 > searchData_apply.pages)
  45. return;
  46. searchData_apply.data.userId = app.data.userInfo.userId;
  47. searchData_apply.pageNum =
  48. type === 1 ? 1 : searchData_apply.pageNum + 1;
  49. visitoryVisitList(searchData_apply).then(res => {
  50. list_apply =
  51. type === 1 ? res.data.list : list_apply.concat(res.data.list);
  52. searchData_apply.pages = res.data.pages;
  53. this.setData({
  54. list_apply: list_apply,
  55. total: res.data.total
  56. });
  57. });
  58. },
  59. /**
  60. * 生命周期函数--监听页面加载
  61. */
  62. onLoad: function(options) {},
  63. /**
  64. * 生命周期函数--监听页面初次渲染完成
  65. */
  66. onReady: function() {},
  67. /**
  68. * 生命周期函数--监听页面显示
  69. */
  70. onShow: function() {
  71. this.setData({
  72. language: app.data.language
  73. });
  74. this.getList(1);
  75. },
  76. /**
  77. * 生命周期函数--监听页面隐藏
  78. */
  79. onHide: function() {},
  80. /**
  81. * 生命周期函数--监听页面卸载
  82. */
  83. onUnload: function() {},
  84. /**
  85. * 页面相关事件处理函数--监听用户下拉动作
  86. */
  87. onPullDownRefresh: function() {
  88. this.getList(this.data.pageNum);
  89. },
  90. /**
  91. * 页面上拉触底事件的处理函数
  92. */
  93. onReachBottom: function() {
  94. this.getList(2);
  95. },
  96. /**
  97. * 用户点击右上角分享
  98. */
  99. onShareAppMessage: function() {}
  100. });