index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 = { order_num: '1', receive_user_name: '8', status_name: '其他', order: [{ name: '1',num:'111',money:'99' }] }
  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. let data = [{ order_num: '1', receive_user_name: '8', status_name: '其他' }]
  50. this.setData({ list: data })
  51. // wx.getStorage({
  52. // key: 'user',
  53. // success: res => {
  54. // if (res.data) {
  55. // // 查询菜单
  56. // if (res.data) this.searchRouter(res.data);
  57. // res.data.type = type.find((i) => i.value == res.data.type).label;
  58. // if (res.data) this.setData({ userInfo: res.data });
  59. // if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
  60. // } else {
  61. // wx.redirectTo({ url: '/pages/login/index', })
  62. // }
  63. // }
  64. // })
  65. },
  66. // 计算高度
  67. searchHeight: function () {
  68. let frameStyle = this.data.frameStyle;
  69. let client = app.globalData.client;
  70. // 减去状态栏
  71. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  72. // 是否减去底部菜单
  73. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  74. if (infoHeight) this.setData({ infoHeight: infoHeight })
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面显示
  83. */
  84. onShow: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面隐藏
  88. */
  89. onHide: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面卸载
  93. */
  94. onUnload: function () {
  95. },
  96. /**
  97. * 页面相关事件处理函数--监听用户下拉动作
  98. */
  99. onPullDownRefresh: function () {
  100. },
  101. /**
  102. * 页面上拉触底事件的处理函数
  103. */
  104. onReachBottom: function () {
  105. },
  106. /**
  107. * 用户点击右上角分享
  108. */
  109. onShareAppMessage: function () {
  110. }
  111. })