warning.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. const util = require('../../../utils/util.js');
  2. const api = require('../../../utils/api.js');
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. tab: 1,
  10. list: []
  11. },
  12. checkTab: function(e) {
  13. const that = this;
  14. let type = e.currentTarget.dataset.type;
  15. that.setData({
  16. tab: type
  17. })
  18. that.getUnInInfo();
  19. },
  20. getUnInInfo: function(e) {
  21. const that = this;
  22. let date = new Date();
  23. let stoday = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
  24. let day1 = new Date();
  25. day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
  26. let s1 = day1.getFullYear() + "-" + (day1.getMonth() + 1) + "-" + day1.getDate();
  27. let day3 = new Date();
  28. day3.setTime(day3.getTime() - 3 * 24 * 60 * 60 * 1000);
  29. let s3 = day3.getFullYear() + "-" + (day3.getMonth() + 1) + "-" + day3.getDate();
  30. let day5 = new Date();
  31. day5.setTime(day5.getTime() - 5 * 24 * 60 * 60 * 1000);
  32. let s5 = day5.getFullYear() + "-" + (day5.getMonth() + 1) + "-" + day5.getDate();
  33. console.log(s1, s3, s5)
  34. util.httpRequest(api.getUnInfo, {
  35. start: that.data.tab == 1 ? s1 : that.data.tab == 3 ? s3 : s5,
  36. end: stoday,
  37. page: 1,
  38. rows: 20,
  39. unInCount: that.data.tab
  40. }, 'post').then(res => {
  41. that.setData({
  42. list: res.data.data.data
  43. })
  44. })
  45. },
  46. makePhoneCall: function(e) {
  47. let phone = e.currentTarget.dataset.phone;
  48. wx.makePhoneCall({
  49. phoneNumber: phone,
  50. })
  51. },
  52. /**
  53. * 生命周期函数--监听页面加载
  54. */
  55. onLoad: function(options) {
  56. const that = this;
  57. that.getUnInInfo();
  58. },
  59. /**
  60. * 生命周期函数--监听页面初次渲染完成
  61. */
  62. onReady: function() {
  63. },
  64. /**
  65. * 生命周期函数--监听页面显示
  66. */
  67. onShow: function() {
  68. },
  69. /**
  70. * 生命周期函数--监听页面隐藏
  71. */
  72. onHide: function() {
  73. },
  74. /**
  75. * 生命周期函数--监听页面卸载
  76. */
  77. onUnload: function() {
  78. },
  79. /**
  80. * 页面相关事件处理函数--监听用户下拉动作
  81. */
  82. onPullDownRefresh: function() {
  83. },
  84. /**
  85. * 页面上拉触底事件的处理函数
  86. */
  87. onReachBottom: function() {
  88. }
  89. })