index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. const app = getApp()
  2. import { examine_status } from '../../utils/dict';
  3. import WxValidate from '../../utils/wxValidate';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. frameStyle: { useTop: true, name: '订单管理', leftArrow: true, useBar: false },
  10. searchInfo: {},
  11. list: [],
  12. dialog: { title: '详细信息', show: false, type: '1' },
  13. info: {},
  14. },
  15. // 跳转菜单
  16. back(e) {
  17. wx.navigateBack({ delta: 1 })
  18. },
  19. // 查询
  20. search: function (e) { console.log('查询'); },
  21. // 查看
  22. toView: async function (e) {
  23. const that = this;
  24. const { item } = e.currentTarget.dataset;
  25. const arr = await app.$get(`/newCourt/api/payOrder/${item._id}`);
  26. if (arr.errcode == '0') {
  27. // 用户信息
  28. const user = await app.$get(`/newCourt/api/user/${arr.data.openid}`);
  29. if (user.errcode = '0') { arr.data.user_name = user.data.name };
  30. that.setData({ info: arr.data })
  31. that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  32. }
  33. },
  34. // 关闭弹框
  35. toClose: function () {
  36. const that = this;
  37. that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
  38. },
  39. /**
  40. * 生命周期函数--监听页面加载
  41. */
  42. onLoad: function (options) {
  43. const that = this;
  44. that.watchLogin();
  45. },
  46. // 监听用户是否登录
  47. watchLogin: async function () {
  48. const that = this;
  49. wx.getStorage({
  50. key: 'user',
  51. success: async res => {
  52. const arr = await app.$get(`/newCourt/api/payOrder`);
  53. if (arr.errcode == '0') {
  54. for (const val of arr.data) {
  55. // 用户信息
  56. const user = await app.$get(`/newCourt/api/user/${val.openid}`);
  57. if (user.errcode = '0') { val.user_name = user.data.name };
  58. }
  59. that.setData({ list: arr.data })
  60. }
  61. },
  62. fail: res => {
  63. wx.redirectTo({ url: '/pages/index/index', })
  64. }
  65. })
  66. },
  67. /**
  68. * 生命周期函数--监听页面初次渲染完成
  69. */
  70. onReady: function () {
  71. },
  72. /**
  73. * 生命周期函数--监听页面显示
  74. */
  75. onShow: function () {
  76. },
  77. /**
  78. * 生命周期函数--监听页面隐藏
  79. */
  80. onHide: function () {
  81. },
  82. /**
  83. * 生命周期函数--监听页面卸载
  84. */
  85. onUnload: function () {
  86. },
  87. /**
  88. * 页面相关事件处理函数--监听用户下拉动作
  89. */
  90. onPullDownRefresh: function () {
  91. },
  92. /**
  93. * 页面上拉触底事件的处理函数
  94. */
  95. onReachBottom: function () {
  96. },
  97. /**
  98. * 用户点击右上角分享
  99. */
  100. onShareAppMessage: function () {
  101. }
  102. })