index.js 3.1 KB

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