index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. frameStyle: { useTop: true, name: '采购申请', leftArrow: true, useBar: false },
  8. // 主体高度
  9. infoHeight: '',
  10. // 采购申请
  11. list: [],
  12. // 弹框
  13. dialog: { title: '详细信息', show: false, type: '1' },
  14. // 详细信息
  15. info: { user_name: '法外狂徒张三', user_phone: '12345678901', examine_name: '李四', examine_date: '111', examine_desc: '我想不同意,但我还是同意了', order: [{ name: '小洋人', num: '121', desc: '别卖太便宜了,赔钱' }], },
  16. },
  17. back: function () {
  18. wx.navigateBack({ url: '/pages/apply/index' })
  19. },
  20. // 添加采购申请
  21. toAdd: function () {
  22. wx.navigateTo({ url: `/pages/apply/detail` })
  23. },
  24. // 详细信息
  25. toView: function (e) {
  26. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  27. },
  28. // 领取确认
  29. toConfirm: function (e) {
  30. wx.showToast({ title: `领取确认成功`, icon: 'success', duration: 2000 });
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {
  36. this.watchLogin();
  37. // 计算高度
  38. this.searchHeight();
  39. },
  40. // 监听用户是否登录
  41. watchLogin: function () {
  42. let data = [
  43. { user_name: '法外狂徒张三', user_phone: '12345678901', examine_date: '111', status_name: '待审', status: '2' }
  44. ]
  45. this.setData({ list: data })
  46. // wx.getStorage({
  47. // key: 'user',
  48. // success: res => {
  49. // if (res.data) {
  50. // // 查询菜单
  51. // if (res.data) this.searchRouter(res.data);
  52. // res.data.type = type.find((i) => i.value == res.data.type).label;
  53. // if (res.data) this.setData({ userInfo: res.data });
  54. // if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
  55. // } else {
  56. // wx.redirectTo({ url: '/pages/login/index', })
  57. // }
  58. // }
  59. // })
  60. },
  61. // 计算高度
  62. searchHeight: function () {
  63. let frameStyle = this.data.frameStyle;
  64. let client = app.globalData.client;
  65. // 减去状态栏
  66. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  67. // 是否减去底部菜单
  68. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  69. if (infoHeight) this.setData({ infoHeight: infoHeight })
  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. })