warning.js 2.3 KB

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