index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // pages/login/login.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. frameStyle: { useTop: true, name: '入库管理', leftArrow: true, useBar: false },
  9. // 主体高度
  10. infoHeight: '',
  11. // 采购申请
  12. list: [],
  13. // 弹框
  14. dialog: { title: '详细信息', show: false, type: '1' },
  15. // 详细信息
  16. info: {},
  17. },
  18. back: function () {
  19. wx.navigateBack({ url: '/pages/home/index' })
  20. },
  21. // 添加入库
  22. toAdd: function () {
  23. wx.navigateTo({ url: `/pages/indepot/detail` })
  24. },
  25. // 详细信息
  26. toView: function (e) {
  27. let data = { id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16', reason: '无', order: [{ name: '商品1', num: '10' }] }
  28. this.setData({ info: data })
  29. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. // 监听用户是否登录
  36. this.watchLogin();
  37. // 计算高度
  38. this.searchHeight();
  39. },
  40. // 监听用户是否登录
  41. watchLogin: function () {
  42. let data = [{ id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16' }]
  43. this.setData({ list: data })
  44. // wx.getStorage({
  45. // key: 'user',
  46. // success: res => {
  47. // if (res.data) {
  48. // // 查询菜单
  49. // if (res.data) this.searchRouter(res.data);
  50. // res.data.type = type.find((i) => i.value == res.data.type).label;
  51. // if (res.data) this.setData({ userInfo: res.data });
  52. // if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
  53. // } else {
  54. // wx.redirectTo({ url: '/pages/login/index', })
  55. // }
  56. // }
  57. // })
  58. },
  59. // 计算高度
  60. searchHeight: function () {
  61. let frameStyle = this.data.frameStyle;
  62. let client = app.globalData.client;
  63. // 减去状态栏
  64. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  65. // 是否减去底部菜单
  66. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  67. if (infoHeight) this.setData({ infoHeight: infoHeight })
  68. },
  69. /**
  70. * 生命周期函数--监听页面初次渲染完成
  71. */
  72. onReady: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面显示
  76. */
  77. onShow: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面隐藏
  81. */
  82. onHide: function () {
  83. },
  84. /**
  85. * 生命周期函数--监听页面卸载
  86. */
  87. onUnload: function () {
  88. },
  89. /**
  90. * 页面相关事件处理函数--监听用户下拉动作
  91. */
  92. onPullDownRefresh: function () {
  93. },
  94. /**
  95. * 页面上拉触底事件的处理函数
  96. */
  97. onReachBottom: function () {
  98. },
  99. /**
  100. * 用户点击右上角分享
  101. */
  102. onShareAppMessage: function () {
  103. }
  104. })