order.js 2.1 KB

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