index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // pages/order/index.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. userInfo: {},
  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 item = e.currentTarget.dataset.item;
  27. this.setData({ info: item })
  28. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  29. },
  30. // 订单确认
  31. toCheck: function (e) {
  32. wx.showModal({
  33. title: '订单确认',
  34. content: '您是否同意订单?',
  35. confirmText: '同意',
  36. cancelText: '拒绝',
  37. success: (res) => {
  38. if (res.confirm) wx.showToast({ title: `已成功同意订单`, icon: 'success', duration: 2000 })
  39. else if (res.cancel) wx.showToast({ title: `已拒绝该订单`, icon: 'error', duration: 2000 })
  40. }
  41. })
  42. },
  43. /**
  44. * 生命周期函数--监听页面加载
  45. */
  46. onLoad: function (options) {
  47. this.watchLogin();
  48. // 计算高度
  49. this.searchHeight();
  50. },
  51. // 监听用户是否登录
  52. watchLogin: function () {
  53. let data = [
  54. { order_num: 'Ygj4757945hdFueu', receive_user_name: '胡英俊', mech_name: '翻斗幼儿园-小豆班', status_name: '待供货单位确认', status: '0', user_name: '采购人员', user_phone: '12345678901', money: '3344', receive_user_phone: '98765432109', receive_address: '翻斗大街翻斗花园2号楼1001室', },
  55. { order_num: 'Hgj4757945hdFueu', receive_user_name: '胡图图', mech_name: '翻斗幼儿园-小豆班', status_name: '待供货单位确认', status: '1', user_name: '采购人员', user_phone: '12345678901', money: '3344', receive_user_phone: '98765432109', receive_address: '翻斗大街翻斗花园2号楼1001室', order: [{ name: '小洋人', num: '123', money: '3000' }, { name: '娃哈哈', num: '123', money: '344' }] }]
  56. this.setData({ list: data })
  57. // wx.getStorage({
  58. // key: 'user',
  59. // success: res => {
  60. // if (res.data) {
  61. // // 查询菜单
  62. // if (res.data) this.searchRouter(res.data);
  63. // res.data.type = type.find((i) => i.value == res.data.type).label;
  64. // if (res.data) this.setData({ userInfo: res.data });
  65. // if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
  66. // } else {
  67. // wx.redirectTo({ url: '/pages/login/index', })
  68. // }
  69. // }
  70. // })
  71. },
  72. // 计算高度
  73. searchHeight: function () {
  74. let frameStyle = this.data.frameStyle;
  75. let client = app.globalData.client;
  76. // 减去状态栏
  77. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  78. // 是否减去底部菜单
  79. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  80. if (infoHeight) this.setData({ infoHeight: infoHeight })
  81. },
  82. /**
  83. * 生命周期函数--监听页面初次渲染完成
  84. */
  85. onReady: function () {
  86. },
  87. /**
  88. * 生命周期函数--监听页面显示
  89. */
  90. onShow: function () {
  91. },
  92. /**
  93. * 生命周期函数--监听页面隐藏
  94. */
  95. onHide: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面卸载
  99. */
  100. onUnload: function () {
  101. },
  102. /**
  103. * 页面相关事件处理函数--监听用户下拉动作
  104. */
  105. onPullDownRefresh: function () {
  106. },
  107. /**
  108. * 页面上拉触底事件的处理函数
  109. */
  110. onReachBottom: function () {
  111. },
  112. /**
  113. * 用户点击右上角分享
  114. */
  115. onShareAppMessage: function () {
  116. }
  117. })