order.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // pages/order/order.js
  2. const app = getApp()
  3. var host = app.globalData.host;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. act:1,
  10. code:0,
  11. uid:'',
  12. list:[],
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. wx.getStorage({
  19. key: 'uid',
  20. success: res => {
  21. if (res.data) {
  22. this.setData({
  23. uid: res.data
  24. })
  25. this.getData();
  26. }
  27. },
  28. })
  29. },
  30. getData:function(){
  31. wx.showNavigationBarLoading()
  32. wx.request({
  33. url: host + '/api/user/signup/list',
  34. method: 'GET',
  35. data: {
  36. type: this.data.act,
  37. uid: this.data.uid
  38. },
  39. success: res=> {
  40. wx.hideNavigationBarLoading();
  41. this.setData({
  42. list: res.data.data.list
  43. })
  44. },
  45. fail: function () {
  46. wx.hideLoading();
  47. wx.showToast({
  48. title: '服务器开小差啦!',
  49. icon: 'none'
  50. })
  51. }
  52. })
  53. },
  54. verify:function(e){
  55. var code=e.target.dataset.url;
  56. this.setData({
  57. code:code
  58. })
  59. },
  60. close:function(){
  61. this.setData({
  62. code: ''
  63. })
  64. },
  65. tab:function(e){
  66. this.setData({
  67. act:e.target.dataset.id
  68. })
  69. this.getData();
  70. },
  71. /**
  72. * 生命周期函数--监听页面初次渲染完成
  73. */
  74. onReady: function () {
  75. },
  76. /**
  77. * 生命周期函数--监听页面显示
  78. */
  79. onShow: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面隐藏
  83. */
  84. onHide: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面卸载
  88. */
  89. onUnload: function () {
  90. },
  91. /**
  92. * 页面相关事件处理函数--监听用户下拉动作
  93. */
  94. onPullDownRefresh: function () {
  95. },
  96. /**
  97. * 页面上拉触底事件的处理函数
  98. */
  99. onReachBottom: function () {
  100. },
  101. /**
  102. * 用户点击右上角分享
  103. */
  104. onShareAppMessage: function () {
  105. }
  106. })