index.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. const { apply_status } = require('../../utils/dict');
  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. shoopingtext: '',
  19. // 审核
  20. checkForm: {},
  21. // 比对结果
  22. resultList: [{ name: '121', num: '9999999' }]
  23. },
  24. back: function () {
  25. wx.navigateBack({ url: '/pages/home/index' })
  26. },
  27. // 详细信息
  28. toView: function (e) {
  29. let item = e.currentTarget.dataset.item;
  30. this.setData({ info: item })
  31. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  32. },
  33. // 自动对比库存
  34. toContrast: function (e) {
  35. this.setData({ dialog: { title: '比对结果', show: true, type: '3' } })
  36. },
  37. // 审核信息是否是采买,还是领取
  38. toCheck: function (e) {
  39. this.setData({ dialog: { title: '审核信息', show: true, type: '2' } })
  40. },
  41. // 提交审核
  42. checkSubmit: function (e) {
  43. this.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
  44. },
  45. // 查询
  46. shoppinginput: function (e) {
  47. console.log('搜索', e.detail.value);
  48. this.setData({ shoopingtext: e.detail.value })
  49. },
  50. /**
  51. * 生命周期函数--监听页面加载
  52. */
  53. onLoad: function (options) {
  54. this.watchLogin();
  55. // 计算高度
  56. this.searchHeight();
  57. },
  58. // 监听用户是否登录
  59. watchLogin: function () {
  60. let data = [
  61. { id: '001', user_name: '法外狂徒张三', user_phone: '12345678901', examine_name: '李四', examine_date: '111', status_name: '待审', status: '1', examine_desc: '我想不同意,但我还是同意了', order: [{ name: '小洋人', num: '121', desc: '别卖太便宜了,赔钱' }], },
  62. { id: '002', user_name: '小红帽', user_phone: '98765432109', examine_date: '222', examine_name: '赵五', status_name: '待审', status: '1', examine_desc: '我想不同意,但我还是同意了', order: [{ name: '小洋人', num: '121', desc: '别卖太便宜了,赔钱' }], }
  63. ]
  64. this.setData({ list: data })
  65. // wx.getStorage({
  66. // key: 'user',
  67. // success: res => {
  68. // if (res.data) {
  69. // // 查询菜单
  70. // if (res.data) this.searchRouter(res.data);
  71. // res.data.type = type.find((i) => i.value == res.data.type).label;
  72. // if (res.data) this.setData({ userInfo: res.data });
  73. // if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
  74. // } else {
  75. // wx.redirectTo({ url: '/pages/login/index', })
  76. // }
  77. // }
  78. // })
  79. },
  80. // 计算高度
  81. searchHeight: function () {
  82. let frameStyle = this.data.frameStyle;
  83. let client = app.globalData.client;
  84. // 减去状态栏
  85. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  86. // 是否减去底部菜单
  87. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  88. if (infoHeight) this.setData({ infoHeight: infoHeight })
  89. },
  90. /**
  91. * 生命周期函数--监听页面初次渲染完成
  92. */
  93. onReady: function () {
  94. },
  95. /**
  96. * 生命周期函数--监听页面显示
  97. */
  98. onShow: function () {
  99. },
  100. /**
  101. * 生命周期函数--监听页面隐藏
  102. */
  103. onHide: function () {
  104. },
  105. /**
  106. * 生命周期函数--监听页面卸载
  107. */
  108. onUnload: function () {
  109. },
  110. /**
  111. * 页面相关事件处理函数--监听用户下拉动作
  112. */
  113. onPullDownRefresh: function () {
  114. },
  115. /**
  116. * 页面上拉触底事件的处理函数
  117. */
  118. onReachBottom: function () {
  119. },
  120. /**
  121. * 用户点击右上角分享
  122. */
  123. onShareAppMessage: function () {
  124. }
  125. })