record.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // pages/signFor/record.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. typeid: 0,
  9. typelist: ['未取', '已取'],
  10. selectitem: '',
  11. selectInfo: [],
  12. date: '',
  13. content: []
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. this.getinfo()
  20. this.getdata()
  21. },
  22. bindDateChange: function (e) {
  23. let that = this
  24. that.setData({
  25. date: e.detail.value,pageindex: 1,content: []
  26. })
  27. that.getdata()
  28. },
  29. changeisselect() {
  30. this.setData({ isselect: !this.data.isselect })
  31. },
  32. chooseselect(e) {
  33. this.setData({ selectitem: e.currentTarget.dataset.item,pageindex: 1,content: []})
  34. this.changeisselect()
  35. this.getdata()
  36. },
  37. getinfo() {
  38. let that = this
  39. app.api.useApi(app.globalData.baseAppUrl + "api/admin/shop_list", {}, "get").then(function (res) {
  40. wx.hideLoading();
  41. if (res.code == 200) {
  42. that.setData({ selectInfo: res.message.data })
  43. } else {
  44. }
  45. }).catch(function (err) {
  46. console.log(222);
  47. })
  48. },
  49. getdata() {
  50. var that = this
  51. wx.showLoading()
  52. app.api.useApi(app.globalData.baseAppUrl + "api/admin/temporary_list", {
  53. status: that.data.typeid,
  54. network_id: that.data.selectitem.id || 0,
  55. created_at: that.data.date || ''
  56. }, "get").then(function (res) {
  57. console.log(res);
  58. if (res.code != 200) {
  59. wx.showLoading({
  60. title: '数据获取失败',
  61. })
  62. setTimeout(function () {
  63. wx.hideLoading();
  64. }, 1000);
  65. } else {
  66. wx.hideLoading()
  67. if (that.data.pageindex == 1) {
  68. that.setData({ content: [] })
  69. }
  70. if (res.message.data.list.data.length > 0) {
  71. that.setData({ content: that.data.content.concat(res.message.data.list.data) })
  72. } else {
  73. that.setData({ pageindex: that.data.pageindex -= 1 })
  74. }
  75. }
  76. }).catch(function (err) {
  77. console.log(222);
  78. })
  79. },
  80. changetype() {
  81. let that = this
  82. wx.showActionSheet({
  83. itemList: that.data.typelist,
  84. success(res) {
  85. that.setData({typeid: res.tapIndex,pageindex: 1,content: []})
  86. that.getdata()
  87. }
  88. })
  89. },
  90. /**
  91. * 生命周期函数--监听页面初次渲染完成
  92. */
  93. onReady: function () {
  94. },
  95. /**
  96. * 生命周期函数--监听页面显示
  97. */
  98. onShow: function () {
  99. },
  100. /**
  101. * 生命周期函数--监听页面隐藏
  102. */
  103. onHide: function () {
  104. },
  105. /**
  106. * 生命周期函数--监听页面卸载
  107. */
  108. onUnload: function () {
  109. },
  110. /**
  111. * 页面相关事件处理函数--监听用户下拉动作
  112. */
  113. onPullDownRefresh: function () {
  114. },
  115. /**
  116. * 页面上拉触底事件的处理函数
  117. */
  118. onReachBottom: function () {
  119. this.setData({ pageindex: this.data.pageindex += 1 })
  120. this.getdata()
  121. },
  122. /**
  123. * 用户点击右上角分享
  124. */
  125. onShareAppMessage: function () {
  126. }
  127. })