index.js 4.0 KB

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